@@ -46,7 +46,7 @@ def test_create(self):
4646 p .delete ()
4747 self .assertEqual (start_count , len (self .storage_passwords ))
4848
49- def test_create_with_slashes (self ):
49+ def test_create_with_backslashes (self ):
5050 start_count = len (self .storage_passwords )
5151 realm = "\\ " + testlib .tmpname ()
5252 username = "\\ " + testlib .tmpname ()
@@ -64,6 +64,24 @@ def test_create_with_slashes(self):
6464 p .delete ()
6565 self .assertEqual (start_count , len (self .storage_passwords ))
6666
67+ def test_create_with_slashes (self ):
68+ start_count = len (self .storage_passwords )
69+ realm = "/" + testlib .tmpname ()
70+ username = "/" + testlib .tmpname ()
71+
72+ # Prepends one escaped slash
73+ p = self .storage_passwords .create ("changeme" , username , realm )
74+ self .assertEqual (start_count + 1 , len (self .storage_passwords ))
75+ self .assertEqual (p .realm , realm )
76+ # Prepends one escaped slash
77+ self .assertEqual (p .username , username )
78+ self .assertEqual (p .clear_password , "changeme" )
79+ # Checks for 2 escaped slashes (Splunk encodes the single slash)
80+ self .assertEqual (p .name , realm + ":" + username + ":" )
81+
82+ p .delete ()
83+ self .assertEqual (start_count , len (self .storage_passwords ))
84+
6785 def test_create_norealm (self ):
6886 start_count = len (self .storage_passwords )
6987 username = testlib .tmpname ()
@@ -196,6 +214,13 @@ def test_delete(self):
196214 self .storage_passwords .delete (username , "myrealm" )
197215 self .assertEqual (start_count , len (self .storage_passwords ))
198216
217+ p = self .storage_passwords .create (password = "changeme" , username = username + "/foo" ,
218+ realm = "/myrealm" )
219+ self .assertEqual (start_count + 1 , len (self .storage_passwords ))
220+ print p .name
221+ self .storage_passwords .delete (username + "/foo" , "/myrealm" )
222+ self .assertEqual (start_count , len (self .storage_passwords ))
223+
199224
200225if __name__ == "__main__" :
201226 try :
0 commit comments