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
|
|
|
|
2019-01-05 20:43:48 +01:00
|
|
|
from cbpi.craftbeerpi import CraftBeerPi
|
2019-01-02 21:20:44 +01:00
|
|
|
|
|
|
|
|
2022-02-20 11:50:44 +01:00
|
|
|
class DashboardTestCase(CraftBeerPiTestCase):
|
2019-01-02 21:20:44 +01:00
|
|
|
|
|
|
|
async def test_crud(self):
|
|
|
|
data = {
|
|
|
|
"name": "MyDashboard",
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dashboard_content = {
|
|
|
|
"type": "Test",
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"config": {}
|
|
|
|
}
|
|
|
|
|
2022-02-20 11:50:44 +01:00
|
|
|
resp = await self.client.get(path="/dashboard/current")
|
2019-01-02 21:20:44 +01:00
|
|
|
assert resp.status == 200
|
|
|
|
|
2022-02-20 11:50:44 +01:00
|
|
|
dashboard_id = await resp.json()
|
2019-01-02 21:20:44 +01:00
|
|
|
|
2022-02-20 11:50: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)
|
2022-02-20 11:50:44 +01:00
|
|
|
assert resp.status == 204
|