예제 #1
0
    def test_disconnect_relation(self):
        before = len(get_relations_container(self.app))
        source, target, relation = self._create_relation()
        self.assertEqual(len(get_relations_container(source)), before + 1)
        results = find_relations(source, {'target_id': get_oid(target)})

        before = len(get_relations_container(self.app))
        disconnect(relation)
        self.assertEqual(len(get_relations_container(source)), before - 1)
        results = find_relations(source, {'target_id': get_oid(target)})
        self.assertEqual(len(list(results)), 0)
예제 #2
0
    def test_disconnect_relation(self):
        before = len(get_relations_container(self.app))
        source, target, relation = self._create_relation()
        self.assertEqual(len(get_relations_container(source)), before + 1)
        results = find_relations(source, {'target_id': get_oid(target)})

        before = len(get_relations_container(self.app))
        disconnect(relation)
        self.assertEqual(len(get_relations_container(source)), before - 1)
        results = find_relations(source, {'target_id': get_oid(target)})
        self.assertEqual(len(list(results)), 0)
예제 #3
0
    def test_remove_target(self):
        before = len(get_relations_container(self.app))
        source, target, relation = self._create_relation()
        self.assertEqual(len(get_relations_container(source)), before + 1)
        results = find_relations(source, {'target_id': get_oid(target)})
        self.assertEqual(len(list(results)), 1)

        before = len(get_relations_container(self.app))
        del target.__parent__[target.__name__]
        self.assertEqual(len(get_relations_container(source)), before - 1)
        results = find_relations(source, {'target_id': get_oid(target)})
        self.assertEqual(len(list(results)), 0)
예제 #4
0
    def test_remove_target(self):
        before = len(get_relations_container(self.app))
        source, target, relation = self._create_relation()
        self.assertEqual(len(get_relations_container(source)), before + 1)
        results = find_relations(source, {'target_id': get_oid(target)})
        self.assertEqual(len(list(results)), 1)

        before = len(get_relations_container(self.app))
        del target.__parent__[target.__name__]
        self.assertEqual(len(get_relations_container(source)), before - 1)
        results = find_relations(source, {'target_id': get_oid(target)})
        self.assertEqual(len(list(results)), 0)
예제 #5
0
 def test_catalog_creation(self):
     self.assertIn('relations', self.app)
     self.assertIn('relations_container', self.app)
     catalog = get_relations_catalog(self.app)
     self.assertIsNotNone(catalog)
     self.assertTrue(is_service(get_relations_catalog(self.app)))
     self.assertTrue(is_service(get_relations_container(self.app)))
예제 #6
0
 def test_catalog_creation(self):
     self.assertIn('relations', self.app)
     self.assertIn('relations_container', self.app)
     catalog = get_relations_catalog(self.app)
     self.assertIsNotNone(catalog)
     self.assertTrue(is_service(get_relations_catalog(self.app)))
     self.assertTrue(is_service(get_relations_container(self.app)))