Example #1
0
 def test_compressed_message_bits__add_180_day__output_correct(self):
     message = protocol.AddCreditSmallMessage(id_=1,
                                              days=180,
                                              secret_key=b"\xab" * 16)
     self.assertEqual(message.compressed_message_bits[0:16].bin,
                      "0000010010110011")
     self.assertEqual("122 425 324 553 555", message.to_keycode())
Example #2
0
 def test_compressed_message_bits__add_1_day_message__output_correct(self):
     message = protocol.AddCreditSmallMessage(id_=0,
                                              days=1,
                                              secret_key=b"\xab" * 16)
     self.assertEqual(message.compressed_message_bits[0:16].bin,
                      "0000000000000000")
     self.assertEqual("133 232 343 432 255", message.to_keycode())
Example #3
0
 def test_compressed_message_bits__large_message_id__output_correct(self):
     message = protocol.AddCreditSmallMessage(id_=65234,
                                              days=405,
                                              secret_key=b"\xab" * 16)
     self.assertEqual(message.compressed_message_bits[0:16].bin,
                      "0100100011111110")
     self.assertEqual("143 235 545 435 454", message.to_keycode())
Example #4
0
 def test_compressed_message_bits__add_405_day__output_correct(self):
     message = protocol.AddCreditSmallMessage(id_=125,
                                              days=405,
                                              secret_key=b"\xab" * 16)
     self.assertEqual(message.compressed_message_bits[0:16].bin,
                      "1111010011111110")
     self.assertEqual("132 335 454 524 233", message.to_keycode())
Example #5
0
 def test_compressed_message_bits__add_181_day__output_correct(self):
     message = protocol.AddCreditSmallMessage(id_=10,
                                              days=181,
                                              secret_key=b"\xab" * 16)
     self.assertEqual(message.compressed_message_bits[0:16].bin,
                      "0010100010110100")
     self.assertEqual("132 353 543 455 243", message.to_keycode())
Example #6
0
 def test_compressed_message_bits__add_credit_unlock__output_correct(self):
     message = protocol.AddCreditSmallMessage(
         id_=1,
         days=protocol.SmallMessage.UNLOCK_FLAG,
         secret_key=b"\xab" * 16)
     self.assertEqual(message.compressed_message_bits[0:16].bin,
                      "0000010011111111")
     self.assertEqual("134 435 355 535 552", message.to_keycode())