def test_agent_type(self):
        agent = factories.AgentFactory()
        tree = presentation.objectToPremisAgentXML(agent, 'example.com')
        agent_xml = etree_to_objectify(tree)

        element = agent_xml.agentType
        assert element == agent.agent_type
        assert has_premis_namespace(element)
    def test_agent_identifier_type(self):
        agent = factories.AgentFactory()
        tree = presentation.objectToPremisAgentXML(agent, 'example.com')
        agent_xml = etree_to_objectify(tree)

        element = agent_xml.agentIdentifier.agentIdentifierType
        assert element == settings.LINK_AGENT_ID_TYPE_XML
        assert has_premis_namespace(element)
    def test_agent_identifier_value(self):
        agent = factories.AgentFactory()
        tree = presentation.objectToPremisAgentXML(agent, 'example.com')
        agent_xml = etree_to_objectify(tree)

        element = agent_xml.agentIdentifier.agentIdentifierValue
        identifier = 'http://example.com/agent/{0}/'.format(agent.agent_identifier)
        assert element == identifier
        assert has_premis_namespace(element)
 def test_validate_agentxml(self, premis_schema):
     agent = factories.AgentFactory()
     agent_xml = presentation.objectToPremisAgentXML(agent, 'example.com')
     premis_schema.assert_(agent_xml)
 def test_root_namespace(self):
     agent = factories.AgentFactory()
     agent_xml = presentation.objectToPremisAgentXML(agent, 'example.com')
     assert has_premis_namespace(agent_xml)
 def test_returns_Element(self):
     agent = factories.AgentFactory()
     agent_xml = presentation.objectToPremisAgentXML(agent, 'example.com')
     assert isinstance(agent_xml, etree._Element)