craftbeerpi4-pione/tests/test_dashboard.py

31 lines
813 B
Python
Raw Normal View History

from aiohttp.test_utils import unittest_run_loop
from tests.cbpi_config_fixture import CraftBeerPiTestCase
2019-01-02 21:20:44 +01:00
2019-01-05 20:43:48 +01:00
from cbpi.craftbeerpi import CraftBeerPi
2019-01-02 21:20:44 +01:00
class DashboardTestCase(CraftBeerPiTestCase):
2019-01-02 21:20:44 +01:00
@unittest_run_loop
async def test_crud(self):
data = {
"name": "MyDashboard",
}
dashboard_content = {
"type": "Test",
"x": 0,
"y": 0,
"config": {}
}
resp = await self.client.get(path="/dashboard/current")
2019-01-02 21:20:44 +01:00
assert resp.status == 200
dashboard_id = await resp.json()
2019-01-02 21:20:44 +01:00
# Add dashboard content
2019-01-02 21:20:44 +01:00
dashboard_content["dbid"] = dashboard_id
resp = await self.client.post(path="/dashboard/%s/content" % dashboard_id, json=dashboard_content)
assert resp.status == 204