2022-02-20 11:50:44 +01:00
|
|
|
from aiohttp.test_utils import unittest_run_loop
|
|
|
|
from tests.cbpi_config_fixture import CraftBeerPiTestCase
|
2019-01-02 21:20:44 +01:00
|
|
|
|
|
|
|
|
2022-02-20 11:50:44 +01:00
|
|
|
class IndexTestCase(CraftBeerPiTestCase):
|
2019-01-02 21:20:44 +01:00
|
|
|
|
|
|
|
async def test_index(self):
|
|
|
|
|
|
|
|
|
|
|
|
# Test Index Page
|
|
|
|
resp = await self.client.get(path="/")
|
|
|
|
assert resp.status == 200
|
|
|
|
|
2019-01-04 09:29:09 +01:00
|
|
|
async def test_404(self):
|
|
|
|
# Test Index Page
|
|
|
|
resp = await self.client.get(path="/abc")
|
2019-01-28 22:21:31 +01:00
|
|
|
assert resp.status == 500
|
2019-01-04 09:29:09 +01:00
|
|
|
|
2019-01-02 21:20:44 +01:00
|
|
|
async def test_wrong_login(self):
|
|
|
|
resp = await self.client.post(path="/login", data={"username": "beer", "password": "123"})
|
|
|
|
print("REPONSE STATUS", resp.status)
|
|
|
|
assert resp.status == 403
|
|
|
|
|
|
|
|
async def test_login(self):
|
|
|
|
|
|
|
|
resp = await self.client.post(path="/login", data={"username": "cbpi", "password": "123"})
|
|
|
|
print("REPONSE STATUS", resp.status)
|
|
|
|
assert resp.status == 200
|
|
|
|
|
|
|
|
resp = await self.client.get(path="/logout")
|
|
|
|
print("REPONSE STATUS LGOUT", resp.status)
|
|
|
|
assert resp.status == 200
|