def test_compressed_message_bits__set_lock_message__output_correct(self): message = protocol.SetCreditSmallMessage(id_=1542, days=0, secret_key=b"\xab" * 16) self.assertEqual(message.compressed_message_bits[0:16].bin, "000110" + "10" + "11111110") self.assertEqual("154 445 453 335 225", message.to_keycode())
def test_compressed_message_bits__set_92_day_message__output_correct(self): message = protocol.SetCreditSmallMessage(id_=1, days=92, secret_key=b"\xab" * 16) self.assertEqual(message.compressed_message_bits[0:16].bin, "000001" + "10" + "01011010") self.assertEqual("124 445 543 325 325", message.to_keycode())
def test_compressed_message_bits__set_1_day_message__output_correct(self): message = protocol.SetCreditSmallMessage(id_=0, days=1, secret_key=b"\xab" * 16) self.assertEqual(message.compressed_message_bits[0:16].bin, "000000" + "10" + "00000000") self.assertEqual("142 525 352 252 234", message.to_keycode())
def test_compressed_message_bits__set_unlock_message__output_correct(self): message = protocol.SetCreditSmallMessage( id_=6573, days=protocol.SmallMessage.UNLOCK_FLAG, secret_key=b"\xab" * 16) self.assertEqual(message.compressed_message_bits[0:16].bin, "101101" + "10" + "11111111") self.assertEqual("143 534 323 324 344", message.to_keycode())
def test_compressed_message_bits__set_960_day_message__output_correct( self): message = protocol.SetCreditSmallMessage(id_=1, days=960, secret_key=b"\xab" * 16) self.assertEqual(message.compressed_message_bits[0:16].bin, "000001" + "10" + "11101111") self.assertEqual("152 523 424 453 432", message.to_keycode())