From ba669dd3ef5ce2273adf49d29fb1fc5e9a25bca1 Mon Sep 17 00:00:00 2001
From: Frank Sauerburger <frank@sauerburger.com>
Date: Fri, 8 Jan 2021 17:13:48 +0100
Subject: [PATCH] Add valid toy data to API tests

---
 uhepp_org/uhepp_api/tests/test_plots.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/uhepp_org/uhepp_api/tests/test_plots.py b/uhepp_org/uhepp_api/tests/test_plots.py
index 2f9febd..ad8aa77 100644
--- a/uhepp_org/uhepp_api/tests/test_plots.py
+++ b/uhepp_org/uhepp_api/tests/test_plots.py
@@ -7,6 +7,20 @@ from uhepp_vault.models import Collection, Plot
 
 from uhepp_vault.models import PUBLIC_LEVEL, INTERNAL_LEVEL, PRIVATE_LEVEL
 
+TOY_DATA = {
+    "version": "0.1",
+    "type": "histogram",
+    "stacks": [],
+    "yields": {},
+    "variable": {"symbol": "m"},
+    "bins": {"edges": [0, 10]},
+    "metadata": {
+        "filename": "",
+        "date": "",
+    }
+}
+
+
 class CollectionsEndpointTestCase(TestCase):
     """Test the /collections endpoint of the api"""
 
@@ -483,7 +497,7 @@ class CollectionsEndpointTestCase(TestCase):
     
         response = self.client.post(
             reverse("plot-list"),
-            dict(uhepp={}, collection=collection_url),
+            dict(uhepp=TOY_DATA, collection=collection_url),
             format="json"
         )
         status_code = response.status_code
@@ -542,7 +556,7 @@ class CollectionsEndpointTestCase(TestCase):
         self.client.force_authenticate(self.frank)
         response = self.client.post(
             reverse("plot-list"),
-            dict(uhepp={}, collection=collection_url),
+            dict(uhepp=TOY_DATA, collection=collection_url),
             format="json"
         )
         
-- 
GitLab