2017-09-22 09:30:21 +00:00
|
|
|
import pytest
|
|
|
|
|
2021-07-02 07:21:36 +00:00
|
|
|
from afpy import application
|
2017-09-22 09:30:21 +00:00
|
|
|
|
|
|
|
|
2017-09-22 14:22:25 +00:00
|
|
|
def test_home():
|
2021-07-02 07:21:36 +00:00
|
|
|
response = application.test_client().get("/")
|
2017-09-22 09:30:21 +00:00
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
2019-08-26 14:06:35 +00:00
|
|
|
@pytest.mark.parametrize("name", ["", "communaute"])
|
2017-09-22 14:22:25 +00:00
|
|
|
def test_html(name):
|
2021-07-02 07:21:36 +00:00
|
|
|
response = application.test_client().get(f"/{name}")
|
2017-09-22 09:30:21 +00:00
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
2019-08-26 14:06:35 +00:00
|
|
|
@pytest.mark.parametrize("name", ["charte", "a-propos"])
|
2017-09-22 14:22:25 +00:00
|
|
|
def test_rest(name):
|
2021-07-02 07:21:36 +00:00
|
|
|
response = application.test_client().get(f"/docs/{name}")
|
2017-09-22 14:22:25 +00:00
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
2017-09-22 09:30:21 +00:00
|
|
|
def test_404():
|
2021-07-02 07:21:36 +00:00
|
|
|
response = application.test_client().get("/unknown")
|
2017-09-22 09:30:21 +00:00
|
|
|
assert response.status_code == 404
|
2021-07-02 07:21:36 +00:00
|
|
|
response = application.test_client().get("/docs/unknown")
|
2017-09-22 14:22:25 +00:00
|
|
|
assert response.status_code == 404
|
2021-07-02 07:21:36 +00:00
|
|
|
response = application.test_client().get("/feed/unknown")
|
2017-09-22 14:22:25 +00:00
|
|
|
assert response.status_code == 404
|
2018-10-05 14:50:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_read_posts():
|
2021-07-02 07:21:36 +00:00
|
|
|
response = application.test_client().get("/actualites/page/1")
|
2018-10-05 14:50:17 +00:00
|
|
|
assert response.status_code == 200
|