From bdf9a2a07f94c03cd7c0fb3d60d0bfb46c1e1265 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Sat, 14 Dec 2024 14:37:12 +0100
Subject: [PATCH] Added first system test

---
 lib/python/dbrepo/RestClient.py         |  2 +-
 lib/python/tests/test_system_license.py | 21 +++++++++++++++++++++
 lib/python/tests/test_unit_container.py |  4 ++++
 lib/python/tests/test_unit_license.py   |  2 +-
 4 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 lib/python/tests/test_system_license.py

diff --git a/lib/python/dbrepo/RestClient.py b/lib/python/dbrepo/RestClient.py
index 4ec7569929..31c83fa55e 100644
--- a/lib/python/dbrepo/RestClient.py
+++ b/lib/python/dbrepo/RestClient.py
@@ -36,7 +36,7 @@ class RestClient:
     secure: bool = None
 
     def __init__(self,
-                 endpoint: str = 'http://gateway-service',
+                 endpoint: str = 'http://localhost',
                  username: str = None,
                  password: str = None,
                  secure: bool = True) -> None:
diff --git a/lib/python/tests/test_system_license.py b/lib/python/tests/test_system_license.py
new file mode 100644
index 0000000000..0d2f372ec8
--- /dev/null
+++ b/lib/python/tests/test_system_license.py
@@ -0,0 +1,21 @@
+import unittest
+
+from dbrepo.RestClient import RestClient
+
+from dbrepo.api.dto import License
+
+
+class LicenseSystemTest(unittest.TestCase):
+
+    def test_get_licenses_succeeds(self):
+        exp = [License(identifier='CC-BY-4.0', uri='https://creativecommons.org/licenses/by/4.0/legalcode',
+                       description='The Creative Commons Attribution license allows re-distribution and re-use of a licensed work on the condition that the creator is appropriately credited.'),
+               License(identifier='CC0-1.0', uri='https://creativecommons.org/publicdomain/zero/1.0/legalcode',
+                       description='CC0 waives copyright interest in a work you\'ve created and dedicates it to the world-wide public domain. Use CC0 to opt out of copyright entirely and ensure your work has the widest reach.')]
+        # test
+        response = RestClient().get_licenses()
+        self.assertEqual(exp, response)
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/lib/python/tests/test_unit_container.py b/lib/python/tests/test_unit_container.py
index b7a35e6a4a..ba5236e49a 100644
--- a/lib/python/tests/test_unit_container.py
+++ b/lib/python/tests/test_unit_container.py
@@ -55,8 +55,12 @@ class ContainerUnitTest(unittest.TestCase):
                             running=True,
                             host="data-db",
                             port=12345,
+<<<<<<< Updated upstream
                             sidecar_host="data-db-sidecar",
                             sidecar_port=3305,
+=======
+                            created=datetime.datetime(2024, 3, 26, 10, 11, 0, 0, datetime.timezone.utc),
+>>>>>>> Stashed changes
                             image=Image(id=1,
                                         registry="docker.io",
                                         name="mariadb",
diff --git a/lib/python/tests/test_unit_license.py b/lib/python/tests/test_unit_license.py
index 7f2a52890e..f64ed76d31 100644
--- a/lib/python/tests/test_unit_license.py
+++ b/lib/python/tests/test_unit_license.py
@@ -7,7 +7,7 @@ from dbrepo.RestClient import RestClient
 from dbrepo.api.dto import License
 
 
-class DatabaseUnitTest(unittest.TestCase):
+class LicenseUnitTest(unittest.TestCase):
 
     def test_get_licenses_empty_succeeds(self):
         with requests_mock.Mocker() as mock:
-- 
GitLab