def test_similar_dynamic_routes():
    # GIVEN
    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"

    # 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"

    # 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"

    # 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, {})
def test_non_word_chars_route(req):
    # GIVEN
    app = ApiGatewayResolver()
    event = deepcopy(LOAD_GW_EVENT)

    # WHEN
    @app.get("/accounts/<account_id>")
    def get_account(account_id: str):
        assert account_id == f"{req}"

    # THEN
    event["resource"] = "/accounts/{account_id}"
    event["path"] = f"/accounts/{req}"

    ret = app.resolve(event, None)
    assert ret["statusCode"] == 200