Skip to content

Commit

Permalink
fixed as per black
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnaglodha committed Oct 8, 2024
1 parent 852c0e1 commit 0f955b3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/geoserverx/_async/gsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,12 @@ async def reload_geoserver(self) -> GSResponse:
"""
Client = self.http_client
responses = await Client.put(
"/reload",headers=self.head,
"/reload",
headers=self.head,
)
results = self.response_recognise(responses.status_code)
return results

# Get all geofence rules
async def get_all_geofence_rules(self) -> Union[RulesResponse, GSResponse]:
Client = self.http_client
Expand Down
1 change: 1 addition & 0 deletions src/geoserverx/_sync/gsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def reload_geoserver(self) -> GSResponse:
)
results = self.response_recognise(responses.status_code)
return results

# Get all geofence rules
@exception_handler
def get_all_geofence_rules(self) -> Union[RulesResponse, GSResponse]:
Expand Down
8 changes: 4 additions & 4 deletions src/geoserverx/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ def geofence_rules(
print(result)
else:
typer.echo("Async support will be shortly")


# Reset geoserver
@SyncGeoServerX.exception_handler
@app.command(help="Reset geoserver settings")
Expand All @@ -465,7 +467,8 @@ def reset(
typer.secho(result, fg=typer.colors.GREEN)
else:
typer.echo("Async support will be shortly")



# get geofence rule
@SyncGeoServerX.exception_handler
@app.command(help="Get geofence rule in the Geoserver")
Expand All @@ -490,7 +493,6 @@ def geofence_rule(
print(result)
else:
typer.echo("Async support will be shortly")



# Reload geoserver
Expand All @@ -513,5 +515,3 @@ def reload(
typer.secho(result, fg=typer.colors.GREEN)
else:
typer.echo("Async support will be shortly")


3 changes: 3 additions & 0 deletions tests/_async/test_gsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ async def test_reset_geoserver_validation(
)
response = await create_a_client.reset_geoserver()
assert response.code == 404


# Test - all_geofence_rules
@pytest.mark.asyncio
async def test_all_geofence_rules_validation(
Expand Down Expand Up @@ -544,6 +546,7 @@ async def test_reload_geoserver_NetworkError(create_a_client, respx_mock):
response = await create_a_client.reload_geoserver()
assert response.response == "Error in connecting to Geoserver"


@pytest.mark.asyncio
async def test_all_geofence_rules_success(
create_a_client, respx_mock, good_all_geofence_rules_connection
Expand Down
12 changes: 12 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ def networkbad_layer_groups_connection() -> dict:
def good_reset_geoserver_connection() -> dict:
item = {"code": 200, "response": "Executed successfully'"}
return item


@pytest.fixture
def good_all_geofence_rules_connection() -> dict:
item = {
Expand Down Expand Up @@ -817,6 +819,8 @@ def good_all_geofence_rules_connection() -> dict:
def bad_reset_geoserver_connection() -> dict:
item = {"code": 404, "response": "Result not found"}
return item


@pytest.fixture
def bad_all_geofence_rules_connection() -> dict:
item = {"code": 404, "response": "Result not found"}
Expand All @@ -827,6 +831,8 @@ def bad_all_geofence_rules_connection() -> dict:
def invalid_reset_geoserver_connection() -> dict:
item = {"code": 404, "response": "Result not found"}
return item


@pytest.fixture
def networkbad_all_geofence_rules_connection() -> dict:
item = {"code": 503, "response": "Geoserver unavailable"}
Expand All @@ -837,6 +843,8 @@ def networkbad_all_geofence_rules_connection() -> dict:
def good_reload_geoserver_connection() -> dict:
item = {"code": 200, "response": "Executed successfully'"}
return item


@pytest.fixture
def good_new_geofence_rule_connection() -> dict:
item = {
Expand All @@ -862,6 +870,8 @@ def good_new_geofence_rule_connection() -> dict:
def bad_reload_geoserver_connection() -> dict:
item = {"code": 404, "response": "Result not found"}
return item


@pytest.fixture
def bad_new_geofence_rule_connection() -> dict:
item = {"Rule": ""}
Expand All @@ -872,6 +882,8 @@ def bad_new_geofence_rule_connection() -> dict:
def invalid_reload_geoserver_connection() -> dict:
item = {"code": 404, "response": "Result not found"}
return item


@pytest.fixture
def invalid_new_geofence_rule_connection() -> dict:
item = {"code": 404, "response": "Result not found"}
Expand Down

0 comments on commit 0f955b3

Please sign in to comment.