def test_normalize_workidentifier(self, input, output, Graph): graph = ChangeGraph( Graph(WorkIdentifier(uri=input, creative_work=None))) graph.process(disambiguate=False) assert graph.serialize() == (Graph( WorkIdentifier(uri=output, parse=True, creative_work=None)) if output else [])
def test_get_data(self, generator, model, route, controlled_values, client, Graph): initial_cg = ChangeGraph(Graph(*initial)) initial_cg.process(disambiguate=False) ChangeSet.objects.from_graph(initial_cg, NormalizedDataFactory().id).accept() cg = ChangeGraph(Graph(*generator)) cg.process() for obj in cg.serialize(): if obj['@type'] == model: expected_id = obj['@id'] expected = obj response = client.get('/api/v2/{}/{}/'.format(route, expected_id)) actual = json.loads(response.content.decode(encoding='UTF-8')) assert response.status_code == 200 assert actual['data']['id'] == expected_id assert actual['data']['attributes']['type'] == expected['@type'] for value in controlled_values: assert actual['data']['attributes'][value] == expected[camelCase_to_underscore(value)]
def test_normalize_contributor_creator_relation(self, input, output, Graph): graph = ChangeGraph(Graph(CreativeWork(agent_relations=input))) graph.process(disambiguate=False) assert graph.serialize() == Graph(CreativeWork(agent_relations=output))
def test_normalize_creativework(self, input, output, Graph): graph = ChangeGraph(Graph(CreativeWork(**input))) graph.process(disambiguate=False) assert graph.serialize() == Graph(CreativeWork(**output))
def test_normalize_organization_institution_name(self, input, output, Graph): graph = ChangeGraph(Graph(*input)) graph.process(disambiguate=False) assert graph.serialize() == Graph(*output)
def test_normalize_tag(self, input, output, Graph): graph = ChangeGraph(Graph(CreativeWork(tags=[input]))) graph.process(disambiguate=False) assert graph.serialize() == Graph(CreativeWork(tags=output))
def test_normalize_person_relation(self, input, output, Graph): graph = ChangeGraph(Graph(*input)) graph.process(disambiguate=False) assert graph.serialize() == Graph(*output)
def test_normalize_agent(self, input, output, Graph): graph = ChangeGraph(Graph(input)) graph.process(disambiguate=False) assert graph.serialize() == (Graph(output) if output else [])
def test_normalize_agent(self, input, output, Graph): graph = ChangeGraph(Graph(input)) graph.process(disambiguate=False) assert graph.serialize() == (Graph(output) if output else [])
def test_normalize_contributor_creator_relation(self, input, output, Graph): graph = ChangeGraph(Graph(CreativeWork(agent_relations=input))) graph.process(disambiguate=False) assert graph.serialize() == Graph(CreativeWork(agent_relations=output))
def test_normalize_agentidentifier(self, input, output, Graph): graph = ChangeGraph(Graph(AgentIdentifier(uri=input, agent=None))) graph.process(disambiguate=False) assert graph.serialize() == (Graph(AgentIdentifier(uri=output, parse=True, agent=None)) if output else [])
def test_normalize_agentworkrelation(self, input, output, Graph): graph = ChangeGraph(Graph(input)) graph.process(disambiguate=False) assert graph.serialize() == Graph(output)
def test_normalize_workidentifier(self, input, output, Graph): graph = ChangeGraph(Graph(WorkIdentifier(uri=input, creative_work=None))) graph.process(disambiguate=False) assert graph.serialize() == (Graph(WorkIdentifier(uri=output, parse=True, creative_work=None)) if output else [])
def test_normalize_tag(self, input, output, Graph): graph = ChangeGraph(Graph(CreativeWork(tags=[input]))) graph.process(disambiguate=False) assert graph.serialize() == Graph(CreativeWork(tags=output))
def test_normalize_creativework(self, input, output, Graph): graph = ChangeGraph(Graph(CreativeWork(**input))) graph.process(disambiguate=False) assert graph.serialize() == Graph(CreativeWork(**output))
def test_normalize_agentworkrelation(self, input, output, Graph): graph = ChangeGraph(Graph(input)) graph.process(disambiguate=False) assert graph.serialize() == Graph(output)
def test_normalize_agentidentifier(self, input, output, Graph): graph = ChangeGraph(Graph(AgentIdentifier(uri=input, agent=None))) graph.process(disambiguate=False) assert graph.serialize() == (Graph( AgentIdentifier(uri=output, parse=True, agent=None)) if output else [])
def test_normalize_person_relation(self, input, output, Graph): graph = ChangeGraph(Graph(*input)) graph.process(disambiguate=False) assert graph.serialize() == Graph(*output)
def test_normalize_organization_institution_name(self, input, output, Graph): graph = ChangeGraph(Graph(*input)) graph.process(disambiguate=False) assert graph.serialize() == Graph(*output)