changeset 124:7b8fcccecf05

Add test for tw-13317
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Tue, 28 Sep 2010 12:31:48 +0400
parents 7e327b36e36c
children a13422ae169d
files mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SettingsTest.java
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SettingsTest.java	Tue Aug 31 20:31:01 2010 +0400
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SettingsTest.java	Tue Sep 28 12:31:48 2010 +0400
@@ -51,12 +51,22 @@
     assertEquals("http://user:pwd@host.com/path@", settings.getRepositoryUrl());
   }
 
+  public void test_url_with_at_in_username() {
+    VcsRootImpl vcsRoot = createVcsRoot("http://host.com/path", "my.name@gmail.com", "1234");
+    Settings settings = new Settings(new File("."), vcsRoot);
+    assertEquals("http://my.name%40gmail.com:1234@host.com/path", settings.getRepositoryUrl());
+  }
+
   private VcsRootImpl createVcsRoot(String url) {
+    return createVcsRoot(url, "user", "pwd");
+  }
+
+  private VcsRootImpl createVcsRoot(String url, String userName, String password) {
     VcsRootImpl vcsRoot = new VcsRootImpl(1, Constants.VCS_NAME);
     vcsRoot.addProperty(Constants.HG_COMMAND_PATH_PROP, "hg.exe");
     vcsRoot.addProperty(Constants.REPOSITORY_PROP, url);
-    vcsRoot.addProperty(Constants.USERNAME, "user");
-    vcsRoot.addProperty(Constants.PASSWORD, "pwd");
+    vcsRoot.addProperty(Constants.USERNAME, userName);
+    vcsRoot.addProperty(Constants.PASSWORD, password);
     return vcsRoot;
   }
 }