Ejemplo n.º 1
0
 def test_set_relationship_properties(self):
     relationship_id = core.create_relationship(self.neo4jdb, handle_id='1', other_handle_id='2',
                                                rel_type='Depends_on')
     new_properties = {'test': 'hello world'}
     core.set_relationship_properties(self.neo4jdb, relationship_id=relationship_id, new_properties=new_properties)
     relationship = core.get_relationship(self.neo4jdb, relationship_id=relationship_id)
     self.assertEqual(relationship['test'], new_properties['test'])
Ejemplo n.º 2
0
 def test_set_relationship_properties(self):
     relationship_id = core.create_relationship(self.neo4jdb, handle_id='1', other_handle_id='2',
                                                rel_type='Depends_on')
     new_properties = {'test': 'hello world'}
     core.set_relationship_properties(self.neo4jdb, relationship_id=relationship_id, new_properties=new_properties)
     relationship = core.get_relationship(self.neo4jdb, relationship_id=relationship_id)
     self.assertEqual(relationship, new_properties)
Ejemplo n.º 3
0
    def test_get_relationships(self):
        relationship_id = core.create_relationship(self.neo4jdb,
                                                   handle_id='1',
                                                   other_handle_id='2',
                                                   rel_type='Depends_on')

        relationships = core.get_relationships(self.neo4jdb,
                                               handle_id1='1',
                                               handle_id2='2')
        self.assertIn(relationship_id, relationships)

        relationships = core.get_relationships(self.neo4jdb,
                                               handle_id1='1',
                                               handle_id2='2',
                                               rel_type='Depends_on')
        self.assertIn(relationship_id, relationships)

        # No relationship
        core.create_node(self.neo4jdb,
                         name='Location Node 1',
                         meta_type_label='Location',
                         type_label='Test_Node',
                         handle_id='3')
        relationships = core.get_relationships(self.neo4jdb,
                                               handle_id1='1',
                                               handle_id2='3')
        self.assertEqual(relationships, [])
Ejemplo n.º 4
0
 def test_get_relationship_model(self):
     relationship_id = core.create_relationship(self.neo4jdb,
                                                handle_id='1',
                                                other_handle_id='2',
                                                rel_type='Depends_on')
     relationship_model = core.get_relationship_model(
         self.neo4jdb, relationship_id=relationship_id)
     self.assertIsInstance(relationship_model, models.BaseRelationshipModel)
Ejemplo n.º 5
0
    def test_create_relationship(self):
        core.create_node(self.neo4jdb, name='Location Node 1', meta_type_label='Location',
                         type_label='Test_Node', handle_id='3')
        core.create_node(self.neo4jdb, name='Location Node 2', meta_type_label='Location',
                         type_label='Test_Node', handle_id='4')
        core.create_node(self.neo4jdb, name='Relation Node 1', meta_type_label='Relation',
                         type_label='Test_Node', handle_id='5')
        core.create_node(self.neo4jdb, name='Physical Node 1', meta_type_label='Physical',
                         type_label='Test_Node', handle_id='6')

        relationship_id = core.create_relationship(self.neo4jdb, handle_id='3', other_handle_id='4',
                                                   rel_type='Has')
        self.assertIsInstance(relationship_id, int)

        relationship_id = core.create_relationship(self.neo4jdb, handle_id='5', other_handle_id='4',
                                                   rel_type='Responsible_for')
        self.assertIsInstance(relationship_id, int)

        relationship_id = core.create_relationship(self.neo4jdb, handle_id='6', other_handle_id='4',
                                                   rel_type='Located_in')
        self.assertIsInstance(relationship_id, int)
Ejemplo n.º 6
0
    def test_create_relationship(self):
        core.create_node(self.neo4jdb, name='Location Node 1', meta_type_label='Location',
                         type_label='Test_Node', handle_id='3')
        core.create_node(self.neo4jdb, name='Location Node 2', meta_type_label='Location',
                         type_label='Test_Node', handle_id='4')
        core.create_node(self.neo4jdb, name='Relation Node 1', meta_type_label='Relation',
                         type_label='Test_Node', handle_id='5')
        core.create_node(self.neo4jdb, name='Physical Node 1', meta_type_label='Physical',
                         type_label='Test_Node', handle_id='6')

        relationship_id = core.create_relationship(self.neo4jdb, handle_id='3', other_handle_id='4',
                                                   rel_type='Has')
        self.assertIsInstance(relationship_id, int)

        relationship_id = core.create_relationship(self.neo4jdb, handle_id='5', other_handle_id='4',
                                                   rel_type='Responsible_for')
        self.assertIsInstance(relationship_id, int)

        relationship_id = core.create_relationship(self.neo4jdb, handle_id='6', other_handle_id='4',
                                                   rel_type='Located_in')
        self.assertIsInstance(relationship_id, int)
Ejemplo n.º 7
0
    def test_get_relationships(self):
        relationship_id = core.create_relationship(self.neo4jdb, handle_id='1', other_handle_id='2',
                                                   rel_type='Depends_on')

        relationships = core.get_relationships(self.neo4jdb, handle_id1='1', handle_id2='2')
        self.assertIn(relationship_id, relationships)

        relationships = core.get_relationships(self.neo4jdb, handle_id1='1', handle_id2='2', rel_type='Depends_on')
        self.assertIn(relationship_id, relationships)

        # No relationship
        core.create_node(self.neo4jdb, name='Location Node 1', meta_type_label='Location',
                         type_label='Test_Node', handle_id='3')
        relationships = core.get_relationships(self.neo4jdb, handle_id1='1', handle_id2='3')
        self.assertEqual(relationships, [])
Ejemplo n.º 8
0
 def test_get_relationship_model(self):
     relationship_id = core.create_relationship(self.neo4jdb, handle_id='1', other_handle_id='2',
                                                rel_type='Depends_on')
     relationship_model = core.get_relationship_model(self.neo4jdb, relationship_id=relationship_id)
     self.assertIsInstance(relationship_model, models.BaseRelationshipModel)