-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7c1c88
commit d47c510
Showing
6 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import pytest | ||
|
||
from geoservercloud import GeoServerCloud | ||
|
||
GEOSERVER_URL = "http://localhost:8080/geoserver" | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def geoserver(): | ||
geoserver = GeoServerCloud(url=GEOSERVER_URL) | ||
yield geoserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import responses | ||
from conftest import GEOSERVER_URL | ||
|
||
from geoservercloud.geoservercloud import GeoServerCloud | ||
|
||
|
||
def test_create_workspace(geoserver: GeoServerCloud) -> None: | ||
workspace = "test_workspace" | ||
|
||
with responses.RequestsMock() as rsps: | ||
rsps.post( | ||
url=f"{GEOSERVER_URL}/rest/workspaces.json", | ||
status=201, | ||
) | ||
|
||
response = geoserver.create_workspace(workspace) | ||
|
||
assert response.status_code == 201 | ||
|
||
|
||
@responses.activate | ||
def test_update_workspace(geoserver: GeoServerCloud) -> None: | ||
workspace = "test_workspace" | ||
|
||
with responses.RequestsMock() as rsps: | ||
rsps.post( | ||
url=f"{GEOSERVER_URL}/rest/workspaces.json", | ||
status=409, | ||
) | ||
rsps.put( | ||
url=f"{GEOSERVER_URL}/rest/workspaces/{workspace}.json", | ||
status=200, | ||
) | ||
|
||
response = geoserver.create_workspace(workspace) | ||
|
||
assert response.status_code == 200 | ||
|
||
|
||
@responses.activate | ||
def test_delete_workspace(geoserver: GeoServerCloud) -> None: | ||
workspace = "test_workspace" | ||
|
||
with responses.RequestsMock() as rsps: | ||
rsps.delete( | ||
url=f"{GEOSERVER_URL}/rest/workspaces/{workspace}.json", | ||
status=200, | ||
) | ||
|
||
response = geoserver.delete_workspace(workspace) | ||
|
||
assert response.status_code == 200 |