def test_init(self): # Trival test creates a SignedObject # check that everything initalizes as expected temp = SignedObject({"TestSignatureDictKey": "test"}, "TestSignatureDictKey") self.assertEqual(temp.SignatureDictKey, "TestSignatureDictKey") self.assertEqual(temp.dump(), {"TestSignatureDictKey": "test", "PublicKey": None}) self.assertEqual(temp.__repr__(), temp.serialize()) self.assertIsNotNone(temp.Identifier) temp._identifier = None self.assertIsNotNone(temp.Identifier)
def test_serialize(self): # Test that serilazation returns the correct dictionary and that # it can be retrieved. # create SignedObject temp = SignedObject({"TestSignatureDictKey": "test"}, "TestSignatureDictKey") # serlize SignedObject cbor = temp.serialize() # check that the unserilized serilized dictinary is the same # as before serilazation self.assertEqual(cbor2dict(cbor), temp.dump())
def test_init(self): # Trival test creates a SignedObject # check that everything initalizes as expected signkey = SigObj.generate_signing_key() temp = SignedObject({signkey: "test"}, signkey) self.assertEquals(temp.SignatureKey, signkey) self.assertEquals(temp.dump(), {signkey: "test", "public_key": None}) self.assertEquals(temp.__repr__(), temp.serialize()) self.assertIsNotNone(temp.Identifier) temp._identifier = None self.assertIsNotNone(temp.Identifier)
def test_serialize(self): # Test that serilazation returns the correct dictionary and that # it can be retrieved. # create SignedObject signkey = SigObj.generate_signing_key() temp = SignedObject({signkey: "test"}, signkey) # serlize SignedObject cbor = temp.serialize() # check that the unserilized serilized dictinary is the same # as before serilazation self.assertEquals(cbor2dict(cbor), temp.dump())