Add tests

This commit is contained in:
2022-12-13 22:09:51 +01:00
parent 32f474a0ed
commit a704a63582
10 changed files with 325 additions and 22 deletions

26
tests/test_main.py Normal file
View File

@ -0,0 +1,26 @@
from fastapi.testclient import TestClient
from discord_rss_bot.main import app, create_list_of_webhooks, encode_url
client = TestClient(app)
def test_read_main():
response = client.get("/")
assert response.status_code == 200
def test_add():
response = client.get("/add")
assert response.status_code == 200
def test_search():
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/"
assert encode_url(url_to_quote=before) == after