Skip to content

Commit

Permalink
chore: test cleanup nitpick
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Jul 18, 2021
1 parent b521841 commit 59d91e9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/functional/event_handler/test_api_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,33 +672,32 @@ def test_similar_dynamic_routes():
app = ApiGatewayResolver()
event = deepcopy(LOAD_GW_EVENT)

# WHEN
# r'^/accounts/(?P<account_id>\\w+\\b)$' # noqa: E800
@app.get("/accounts/<account_id>")
def get_account(account_id: str):
assert account_id == "single_account"
return {"message": f"{account_id}"}

# r'^/accounts/(?P<account_id>\\w+\\b)/source_networks$' # noqa: E800
@app.get("/accounts/<account_id>/source_networks")
def get_account_networks(account_id: str):
assert account_id == "nested_account"
return {"message": f"{account_id}"}

# r'^/accounts/(?P<account_id>\\w+\\b)/source_networks/(?P<network_id>\\w+\\b)$' # noqa: E800
@app.get("/accounts/<account_id>/source_networks/<network_id>")
def get_network_account(account_id: str, network_id: str):
assert account_id == "nested_account"
assert network_id == "network"
return {"message": f"{account_id}"}

event["resource"] = "/accounts/{account_id}/source_networks"
event["path"] = "/accounts/nested_account/source_networks"
app.resolve(event, None)

# THEN
event["resource"] = "/accounts/{account_id}"
event["path"] = "/accounts/single_account"
app.resolve(event, None)

event["resource"] = "/accounts/{account_id}/source_networks"
event["path"] = "/accounts/nested_account/source_networks"
app.resolve(event, None)

event["resource"] = "/accounts/{account_id}/source_networks/{network_id}"
event["path"] = "/accounts/nested_account/source_networks/network"
app.resolve(event, {})

0 comments on commit 59d91e9

Please sign in to comment.