Skip to content

Commit

Permalink
add another test to check new method of requiring auth at http reques…
Browse files Browse the repository at this point in the history
…t level
  • Loading branch information
AbstractUmbra committed Oct 3, 2024
1 parent c7ab851 commit 8063e94
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,29 @@ def test_missing(self) -> None:
assert MISSING is not None
assert not bool(MISSING)

def test_route(self) -> None:
route = Route("GET", "/chapter/{chapter_id}", chapter_id="efgh")
@pytest.mark.parametrize(
("route", "match"),
[
(
Route("GET", "/chapter/{chapter_id}", chapter_id="abcd", authenticate=False),
("GET", "/chapter/abcd", False),
),
(
Route("POST", "/manga/{manga_id}", manga_id="some_manga", authenticate=True),
("POST", "/manga/some_manga", True),
),
],
)
def test_route(self, route: Route, match: tuple[str, str, bool]) -> None:
verb, path, auth = match

assert route.verb == verb

assert route.url.scheme == "https"
assert route.url.host == "api.mangadex.org"
assert route.url.path == path

assert route.verb == "GET"
assert route.path == "/chapter/{chapter_id}"
assert str(route.url) == "https://api.mangadex.org/chapter/efgh"
assert route.auth is auth

@pytest.mark.parametrize(
("source", "chunk_size", "chunked"),
Expand Down

0 comments on commit 8063e94

Please sign in to comment.