def test_conductor_entity(self, _): guestsz = gsz.ConductorGuestSerializer(None, self.key) hostsz = hsz.ConductorHostSerializer(None, None) encrypted_entity = guestsz.serialize_entity(self.context, self.data) self.assertNotEqual(encrypted_entity, self.data) entity = hostsz.deserialize_entity(self.context, encrypted_entity) self.assertEqual(entity, self.data)
def test_conductor_context(self, _): guestsz = gsz.ConductorGuestSerializer(None, self.key) hostsz = hsz.ConductorHostSerializer(None, None) encrypted_context = guestsz.serialize_context(self.context) self.assertNotEqual(encrypted_context, self.context) context = hostsz.deserialize_context(encrypted_context) self.assertEqual(context.get('instance_id'), self.uuid) context.pop('instance_id') self.assertDictEqual(context, self.context)
def test_gsz_serialize_context_nokey(self): sz = gsz.ConductorGuestSerializer(None, None) self.assertEqual(sz.serialize_context(self.context), self.context)
def test_gsz_serialize_entity_nokey(self): sz = gsz.ConductorGuestSerializer(None, None) self.assertEqual(sz.serialize_entity(self.context, self.data), self.data)