Пример #1
0
 def test_escape_LongString_UnEscapeSubStr_PartialMatch(self):
     # We should not be able to find the escaped string earlier than it
     # was inserted into an escaped sequence.
     messages = [ "   x", "   x"]
     escape_string = "xxxx"
     encoded = [ Escape.escape(message,escape_string) for message in messages ]
     decoded = [ Escape.unescape(message,escape_string) for message in encoded ]
     self.assertEqual(messages, decoded)
Пример #2
0
 def test_escape_LongString_UnEscapeSubStr_PartialMatch(self):
     # We should not be able to find the escaped string earlier than it
     # was inserted into an escaped sequence.
     messages = [ "   x", "   x"]
     escape_string = "xxxx"
     encoded = [ Escape.escape(message,escape_string) for message in messages ]
     decoded = [ Escape.unescape(message,escape_string) for message in encoded ]
     self.assertEqual(messages, decoded)
Пример #3
0
 def test_unescape_nonEmptyStringNoEscapeNeeded(self):
     message = "XXXXXX"
     expectResult = message
     result = Escape.unescape(message)
     self.assertEqual(expectResult, result)
Пример #4
0
 def test_unescape_emptyString(self):
     message = ""
     expectResult = message
     result = Escape.unescape(message)
     self.assertEqual(expectResult, result)
Пример #5
0
 def test_unescape_LongString_UnEscapeSubStr_MixedPercents_ButtingUp(self):
     message = "X%25X%25%68%65%6c%6c%6fX%25X%68%65%6c%6c%6fX%25X%25X%25X"
     expectResult = "X%X%helloX%XhelloX%X%X%X"
     escape_string = "hello"
     result = Escape.unescape(message,escape_string)
     self.assertEqual(expectResult, result)
Пример #6
0
 def test_unescape_LongString_UnEscapeSubStr(self):
     message = "XXXX%68%65%6c%6c%6fXXXX"
     expectResult = "XXXXhelloXXXX"
     escape_string = "hello"
     result = Escape.unescape(message,escape_string)
     self.assertEqual(expectResult, result)
Пример #7
0
 def test_unescape_LongString_ManyUnEscapePercents(self):
     message = "XXX%25XXXXXXXXXXXXX%25XXXXXXXXXXXXXXXX%25XXXXXXXXXXXXXXXXXXX%25XXXXXXXXXXXXXXXXX%25XXXXXXXXXXXXXX"
     expectResult = "XXX%XXXXXXXXXXXXX%XXXXXXXXXXXXXXXX%XXXXXXXXXXXXXXXXXXX%XXXXXXXXXXXXXXXXX%XXXXXXXXXXXXXX"
     result = Escape.unescape(message)
     self.assertEqual(expectResult, result)
Пример #8
0
 def test_unescape_nonEmptyString_UnEscapePercent(self):
     message = "XXX%25XXX"
     expectResult = "XXX%XXX"
     result = Escape.unescape(message)
     self.assertEqual(expectResult, result)
Пример #9
0
 def test_unescape_LongString_UnEscapeSubStr_MixedPercents_ButtingUp(self):
     message = "X%25X%25%68%65%6c%6c%6fX%25X%68%65%6c%6c%6fX%25X%25X%25X"
     expectResult = "X%X%helloX%XhelloX%X%X%X"
     escape_string = "hello"
     result = Escape.unescape(message,escape_string)
     self.assertEqual(expectResult, result)
Пример #10
0
 def test_unescape_LongString_UnEscapeSubStr(self):
     message = "XXXX%68%65%6c%6c%6fXXXX"
     expectResult = "XXXXhelloXXXX"
     escape_string = "hello"
     result = Escape.unescape(message,escape_string)
     self.assertEqual(expectResult, result)
Пример #11
0
 def test_unescape_LongString_ManyUnEscapePercents(self):
     message = "XXX%25XXXXXXXXXXXXX%25XXXXXXXXXXXXXXXX%25XXXXXXXXXXXXXXXXXXX%25XXXXXXXXXXXXXXXXX%25XXXXXXXXXXXXXX"
     expectResult = "XXX%XXXXXXXXXXXXX%XXXXXXXXXXXXXXXX%XXXXXXXXXXXXXXXXXXX%XXXXXXXXXXXXXXXXX%XXXXXXXXXXXXXX"
     result = Escape.unescape(message)
     self.assertEqual(expectResult, result)
Пример #12
0
 def test_unescape_nonEmptyString_UnEscapePercent(self):
     message = "XXX%25XXX"
     expectResult = "XXX%XXX"
     result = Escape.unescape(message)
     self.assertEqual(expectResult, result)
Пример #13
0
 def test_unescape_nonEmptyStringNoEscapeNeeded(self):
     message = "XXXXXX"
     expectResult = message
     result = Escape.unescape(message)
     self.assertEqual(expectResult, result)
Пример #14
0
 def test_unescape_emptyString(self):
     message = ""
     expectResult = message
     result = Escape.unescape(message)
     self.assertEqual(expectResult, result)