2023-05-19 13:21:11 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import unittest
|
2024-01-18 23:51:57 +00:00
|
|
|
import time
|
2023-05-19 13:21:11 +00:00
|
|
|
|
|
|
|
from pyvulnerabilitylookup import PyVulnerabilityLookup
|
|
|
|
|
|
|
|
|
|
|
|
class TestBasic(unittest.TestCase):
|
|
|
|
|
2024-01-17 11:41:24 +00:00
|
|
|
def setUp(self) -> None:
|
2023-05-19 13:21:11 +00:00
|
|
|
self.client = PyVulnerabilityLookup(root_url="http://127.0.0.1:10001")
|
|
|
|
|
2024-01-17 11:41:24 +00:00
|
|
|
def test_up(self) -> None:
|
2023-05-19 13:21:11 +00:00
|
|
|
self.assertTrue(self.client.is_up)
|
|
|
|
self.assertTrue(self.client.redis_up())
|
|
|
|
|
2024-01-17 11:41:24 +00:00
|
|
|
def test_get_vulnerability(self) -> None:
|
2024-01-18 23:51:57 +00:00
|
|
|
while True:
|
|
|
|
if vuln := self.client.get_vulnerability('PYSEC-2024-4'):
|
|
|
|
self.assertEqual(vuln['id'], 'PYSEC-2024-4')
|
|
|
|
break
|
|
|
|
print('waiting for pysec to be imported')
|
|
|
|
time.sleep(1)
|