From eff72a696127ec022699145b02d99638fd509d82 Mon Sep 17 00:00:00 2001
From: jrybicki-jsc <j.rybicki@fz-juelich.de>
Date: Fri, 28 May 2021 10:31:58 +0200
Subject: [PATCH] test using testcase

---
 tests/apiserver_tests/test_responsiveness.py | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/tests/apiserver_tests/test_responsiveness.py b/tests/apiserver_tests/test_responsiveness.py
index 04cde63..ba81466 100644
--- a/tests/apiserver_tests/test_responsiveness.py
+++ b/tests/apiserver_tests/test_responsiveness.py
@@ -5,19 +5,22 @@ from fastapi.testclient import TestClient
 
 from context import apiserver
 from context import storage
+import unittest
 
-client = TestClient(apiserver.app)
 
-# get root
-def test_root():
-    rsp = client.get('/')
-    assert rsp.status_code >= 200 and rsp.status_code < 300 # any 200 response is fine, as a get to the root should not return any error
+class SomeTests(unittest.TestCase):
+    def setUp(self):
+        self.client = TestClient(apiserver.app)
 
-# get every type in type enum
-def test_types():
-    for location_type in storage.LocationDataType:
-        rsp = client.get('/' + location_type.value)
-        assert rsp.status_code >= 200 and rsp.status_code < 300 # any 200 response is fine, as a get to the datatypes should not return any error
+    
+    def test_root(self):
+        rsp = self.client.get('/')
+        assert rsp.status_code >= 200 and rsp.status_code < 300 # any 200 response is fine, as a get to the root should not return any error
+
+    def test_types(self):
+        for location_type in storage.LocationDataType:
+            rsp = self.client.get('/' + location_type.value)
+            assert rsp.status_code >= 200 and rsp.status_code < 300 # any 200 response is fine, as a get to the datatypes should not return any error
 
 # PUT a new dataset, store the id in global variable
 
-- 
GitLab