Add type hints and other small stuff
This commit is contained in:
@ -1,26 +1,33 @@
|
||||
from typing import Literal
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
from httpx import Response
|
||||
|
||||
from discord_rss_bot.main import app, create_list_of_webhooks, encode_url
|
||||
from discord_rss_bot.main import app, encode_url
|
||||
|
||||
client = TestClient(app)
|
||||
client: TestClient = TestClient(app)
|
||||
|
||||
|
||||
def test_read_main():
|
||||
response = client.get("/")
|
||||
def test_read_main() -> None:
|
||||
"""Test the main page."""
|
||||
response: Response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_add():
|
||||
response = client.get("/add")
|
||||
def test_add() -> None:
|
||||
"""Test the /add page."""
|
||||
response: Response = client.get("/add")
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_search():
|
||||
response = client.get("/search/?query=a")
|
||||
def test_search() -> None:
|
||||
"""Test the /search page."""
|
||||
response: Response = client.get("/search/?query=a")
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_encode_url():
|
||||
before = "https://www.google.com/"
|
||||
after = "https%3A//www.google.com/"
|
||||
def test_encode_url() -> None:
|
||||
"""Test the encode_url function."""
|
||||
before: Literal["https://www.google.com/"] = "https://www.google.com/"
|
||||
after: Literal["https%3A//www.google.com/"] = "https%3A//www.google.com/"
|
||||
assert encode_url(url_to_quote=before) == after
|
||||
|
Reference in New Issue
Block a user