fix: make sure the test suite works in local

This commit is contained in:
Raphaël Vinot 2024-11-20 14:36:27 +01:00
parent 51bcb96d61
commit 390629aa49

View file

@ -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)