def tearDown(self): layer = gs_catalog.get_layer(self.layer_name) if layer: gs_catalog.delete(layer) if self.datastore: gs_catalog.delete(self.datastore, recurse=True)
def test_ensure_workspace_exists(self): ws_name = 'nonexistent-workspace' ws_namespace_uri = 'http://nonamespace.com' # Ensure that the workspace doesn't exist ws1 = gs_catalog.get_workspace(ws_name) if ws1 is not None: gs_catalog.delete(ws1) ensure_workspace_exists(gs_catalog, ws_name, ws_namespace_uri) # Check that the workspace now exists ws2 = gs_catalog.get_workspace(ws_name) self.assertNotEqual(ws2, None) # Run again to ensure a preexisting workspace doesn't throw any exceptions ensure_workspace_exists(gs_catalog, ws_name, ws_namespace_uri) gs_catalog.delete(ws2)