From 390629aa4912a397356a78af1d3eab7f19776717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 20 Nov 2024 14:36:27 +0100 Subject: [PATCH] fix: make sure the test suite works in local --- tests/test_web.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/test_web.py b/tests/test_web.py index 7d82294..c91cae7 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -133,6 +133,10 @@ class TestPublic(unittest.TestCase): comments["data"][0]["uuid"], "a309d024-2714-4a81-a425-60f83f6d5740" ) + comment = self.client.get_comment("a309d024-2714-4a81-a425-60f83f6d5740") + self.assertEqual( + comment["uuid"], "a309d024-2714-4a81-a425-60f83f6d5740" + ) comments = self.client.get_comments(uuid="a309d024-2714-4a81-a425-60f83f6d5740") self.assertTrue(len(comments["data"]) == 1) self.assertEqual( @@ -293,9 +297,11 @@ class TestPublic(unittest.TestCase): if not instance_config.get('registration'): return None - user = self.client.create_user(name='test Name', login='test Login', - organisation='test Organization', email='test@testorg.lu') + user = self.client.create_user(name='test_Name', login='test_Login', + organisation='test Organization', email='test@testorg.local') self.assertTrue(user) + self.assertTrue('id' in user, user) + uid = user['id'] self.assertTrue('login' in user, user) self.assertTrue('apikey' in user, user) self.assertTrue('is_commenter' in user, user) @@ -311,8 +317,14 @@ class TestPublic(unittest.TestCase): deleted_comment = self.client.delete_comment(new_comment_uuid) self.assertTrue(deleted_comment < 300) + self.client.set_apikey(self.admin_token) + deleted_user = self.client.delete_user(str(uid)) + self.assertTrue(deleted_user < 300) + # test Sightings - def test_sightings(self) -> None: + def test_sightings_public(self) -> None: + if not self.public_test: + return None sighting_cve = self.client.get_sighting('6febe45d-d8de-4df7-b3ba-6cf7acd2e2b5') self.assertTrue(sighting_cve) self.assertTrue('uuid' in sighting_cve)