def test_raises_Http404_if_object_not_found(self, agent_xml): tree = etree.fromstring(agent_xml.obj_xml) with pytest.raises(Http404): presentation.premisAgentXMLgetObject(tree)
def test_returns_correct_agent_object(self, agent_xml): tree = etree.fromstring(agent_xml.obj_xml) factories.AgentFactory(agent_identifier=agent_xml.identifier) agent_obj = presentation.premisAgentXMLgetObject(tree) assert agent_obj.agent_identifier == agent_xml.identifier assert isinstance(agent_obj, models.Agent)