def test_passing_view(self): request = testing.DummyRequest() request.skos_registry = self.regis atramhasisAdminview = AtramhasisAdminView(request) info = atramhasisAdminview.admin_view() self.assertIsNotNone(info) self.assertTrue('admin' in info)
def test_invalidate_scheme_tree(self): request = testing.DummyRequest() request.matchdict['scheme_id'] = 'TREES' request.skos_registry = self.regis atramhasisAdminview = AtramhasisAdminView(request) info = atramhasisAdminview.invalidate_scheme_tree() self.assertIsNotNone(info)
def test_invalidate_tree(self): tree_cache_dictionary['foo |TREES nl'] = [] tree_cache_dictionary['foo |TREES fr'] = [] tree_cache_dictionary['bar |MATERIALS fr'] = [] request = testing.DummyRequest() request.skos_registry = self.regis atramhasisAdminview = AtramhasisAdminView(request) response = atramhasisAdminview.invalidate_tree() self.assertEqual(response.status_int, 200) self.assertEqual(len(tree_cache_dictionary), 0)
def test_invalidate_scheme_tree(self): tree_cache_dictionary['foo |TREES nl'] = [] tree_cache_dictionary['foo |TREES fr'] = [] tree_cache_dictionary['bar |MATERIALS fr'] = [] request = testing.DummyRequest() request.matchdict['scheme_id'] = 'TREES' request.skos_registry = self.regis atramhasisAdminview = AtramhasisAdminView(request) response = atramhasisAdminview.invalidate_scheme_tree() self.assertEqual(response.status_int, 200) self.assertIn('bar |MATERIALS fr', tree_cache_dictionary.keys()) self.assertNotIn('foo |TREES nl', tree_cache_dictionary.keys()) self.assertNotIn('foo |TREES fr', tree_cache_dictionary.keys())
def test_no_registry(self): error_raised = False request = testing.DummyRequest() try: AtramhasisAdminView(request) except SkosRegistryNotFoundException as e: error_raised = True self.assertIsNotNone(e.__str__()) self.assertTrue(error_raised)