コード例 #1
0
ファイル: test_models.py プロジェクト: sheriefvt/SHARE
 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 [])
コード例 #2
0
    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)]
コード例 #3
0
ファイル: test_models.py プロジェクト: spearous0001/SHARE
 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))
コード例 #4
0
ファイル: test_models.py プロジェクト: spearous0001/SHARE
 def test_normalize_creativework(self, input, output, Graph):
     graph = ChangeGraph(Graph(CreativeWork(**input)))
     graph.process(disambiguate=False)
     assert graph.serialize() == Graph(CreativeWork(**output))
コード例 #5
0
ファイル: test_models.py プロジェクト: spearous0001/SHARE
 def test_normalize_organization_institution_name(self, input, output,
                                                  Graph):
     graph = ChangeGraph(Graph(*input))
     graph.process(disambiguate=False)
     assert graph.serialize() == Graph(*output)
コード例 #6
0
ファイル: test_models.py プロジェクト: spearous0001/SHARE
    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))
コード例 #7
0
ファイル: test_models.py プロジェクト: spearous0001/SHARE
 def test_normalize_person_relation(self, input, output, Graph):
     graph = ChangeGraph(Graph(*input))
     graph.process(disambiguate=False)
     assert graph.serialize() == Graph(*output)
コード例 #8
0
ファイル: test_models.py プロジェクト: spearous0001/SHARE
 def test_normalize_agent(self, input, output, Graph):
     graph = ChangeGraph(Graph(input))
     graph.process(disambiguate=False)
     assert graph.serialize() == (Graph(output) if output else [])
コード例 #9
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
 def test_normalize_agent(self, input, output, Graph):
     graph = ChangeGraph(Graph(input))
     graph.process(disambiguate=False)
     assert graph.serialize() == (Graph(output) if output else [])
コード例 #10
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
 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))
コード例 #11
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
 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 [])
コード例 #12
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
 def test_normalize_agentworkrelation(self, input, output, Graph):
     graph = ChangeGraph(Graph(input))
     graph.process(disambiguate=False)
     assert graph.serialize() == Graph(output)
コード例 #13
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
 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 [])
コード例 #14
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
    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))
コード例 #15
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
 def test_normalize_creativework(self, input, output, Graph):
     graph = ChangeGraph(Graph(CreativeWork(**input)))
     graph.process(disambiguate=False)
     assert graph.serialize() == Graph(CreativeWork(**output))
コード例 #16
0
ファイル: test_models.py プロジェクト: spearous0001/SHARE
 def test_normalize_agentworkrelation(self, input, output, Graph):
     graph = ChangeGraph(Graph(input))
     graph.process(disambiguate=False)
     assert graph.serialize() == Graph(output)
コード例 #17
0
ファイル: test_models.py プロジェクト: sheriefvt/SHARE
 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 [])
コード例 #18
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
 def test_normalize_person_relation(self, input, output, Graph):
     graph = ChangeGraph(Graph(*input))
     graph.process(disambiguate=False)
     assert graph.serialize() == Graph(*output)
コード例 #19
0
ファイル: test_models.py プロジェクト: Stevenholloway/SHARE
 def test_normalize_organization_institution_name(self, input, output, Graph):
     graph = ChangeGraph(Graph(*input))
     graph.process(disambiguate=False)
     assert graph.serialize() == Graph(*output)