From eb71a422ee9b9e5aac1ec5b987a2c297b0e3d7d2 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Mon, 21 Nov 2022 16:50:08 +0200 Subject: [PATCH] add tests --- .../integration_tests/dashboards/api_tests.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/integration_tests/dashboards/api_tests.py b/tests/integration_tests/dashboards/api_tests.py index 35f59f363923c..1ca80aae38dfe 100644 --- a/tests/integration_tests/dashboards/api_tests.py +++ b/tests/integration_tests/dashboards/api_tests.py @@ -275,10 +275,22 @@ def test_get_dashboard_charts(self): response = self.get_assert_metric(uri, "get_charts") self.assertEqual(response.status_code, 200) data = json.loads(response.data.decode("utf-8")) - self.assertEqual(len(data["result"]), 1) - self.assertEqual( - data["result"][0]["slice_name"], dashboard.slices[0].slice_name - ) + assert len(data["result"]) == 1 + result = data["result"][0] + assert set(result.keys()) == { + "cache_timeout", + "certification_details", + "certified_by", + "changed_on", + "description", + "description_markeddown", + "form_data", + "id", + "slice_name", + "slice_url", + } + assert result["id"] == dashboard.slices[0].id + assert result["slice_name"] == dashboard.slices[0].slice_name @pytest.mark.usefixtures("create_dashboards") def test_get_dashboard_charts_by_slug(self):