diff mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java @ 791:249eb1d652a7

Merge branch Gaya-8.1.x
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Thu, 01 May 2014 19:55:03 +0200
parents 06dcc79b304d 914a0b473c45
children f86c06f4ab8a
line wrap: on
line diff
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java	Wed Apr 30 20:13:02 2014 +0200
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java	Thu May 01 19:55:03 2014 +0200
@@ -237,6 +237,26 @@
   }
 
 
+  @TestFor(issues = "TW-36251")
+  public void exception_should_contain_no_password_when_password_is_escaped() throws Exception {
+    String pwd = "pa{{word";//'{' requires escaping
+    String escapedPwd = "pa%7B%7Bword";
+    VcsRootImpl root = vcsRoot().withUrl("http://acme.com").withUserName("user").withPassword(pwd).build();
+    File nonExistingHg = myTempFiles.createTempFile();
+    delete(nonExistingHg);
+    String nonExistingHgPath = nonExistingHg.getAbsolutePath();
+    root.addProperty(Constants.HG_COMMAND_PATH_PROP, nonExistingHgPath);
+    try {
+      myVcs.getTestConnectionSupport().testConnection(root);
+      fail("Exception expected");
+    } catch (VcsException e) {
+      String msg = e.getCause().getMessage();
+      assertFalse(msg.contains(pwd));
+      assertFalse(msg.contains(escapedPwd));
+    }
+  }
+
+
   public void test_tag() throws IOException, VcsException {
     VcsRootImpl vcsRoot = createVcsRoot(simpleRepo());