Example #1
0
 def test_empty_string_and_empty_codes(self):
     secret = ""
     codes = []
     expected_message = None
     decoded_message = secret_decoder.decode_secret(secret, codes)
     self.assertEqual(expected_message, decoded_message)
Example #2
0
 def test_secret_with_matching_codes(self):
     secret = "a1d22n333a4444P"
     codes = ["owl", "panda"]
     expected_message = "panda"
     decoded_message = secret_decoder.decode_secret(secret, codes)
     self.assertEqual(expected_message, decoded_message)
Example #3
0
 def test_random(self):
     secret = "Go, risk it all"
     codes = ["gorilla"]
     expected_message = "gorilla"
     decoded_message = secret_decoder.decode_secret(secret, codes)
     self.assertEqual(expected_message, decoded_message)
 def send_message(self, from_kingdom, to_kingdom, message):
     # print("sending message..{} {} {}".format(
     #     from_kingdom, to_kingdom, message))
     if decode_secret(message.lower(), [to_kingdom.emblem.lower()]):
         return self.ruler_gateway.add_alley(from_kingdom, to_kingdom)
     return False