def test_instance_action_serializer(self): serializer = instance_actions.InstanceActionTemplate() action = self.fake_actions[FAKE_UUID][FAKE_REQUEST_ID] text = serializer.serialize({'instance_action': action}) tree = etree.fromstring(text) action = format_action(action) self.assertEqual('instance_action', tree.tag) self._verify_instance_action_attachment(action, tree) found_events = False for child in tree: if child.tag == 'events': found_events = True self.assertFalse(found_events)
def test_instance_action_events_serializer(self): serializer = instance_actions.InstanceActionTemplate() action = self.fake_actions[FAKE_UUID][FAKE_REQUEST_ID] event = self.fake_events[action['id']][0] action['events'] = [dict(event), dict(event)] text = serializer.serialize({'instance_action': action}) tree = etree.fromstring(text) action = format_action(action) self.assertEqual('instance_action', tree.tag) self._verify_instance_action_attachment(action, tree) event = format_event(event) found_events = False for child in tree: if child.tag == 'events': found_events = True for key in event: self.assertEqual(event[key], child.get(key)) self.assertTrue(found_events)