new: tests for sightings
Some checks are pending
Python application - MyPy / Python 3.10 sample (push) Waiting to run
Python application - MyPy / Python 3.11 sample (push) Waiting to run
Python application - MyPy / Python 3.12 sample (push) Waiting to run
Python application - MyPy / Python 3.13 sample (push) Waiting to run
Python application - Test Public Interface / Python 3.13 sample (push) Waiting to run
Python application - Test Public Interface / Python 3.10 sample (push) Waiting to run
Python application - Test Public Interface / Python 3.11 sample (push) Waiting to run
Python application - Test Public Interface / Python 3.12 sample (push) Waiting to run

This commit is contained in:
Raphaël Vinot 2024-11-18 20:20:54 +01:00
parent 773ef0eea4
commit 97ca98f4ff

View file

@ -4,6 +4,8 @@ import unittest
import time import time
import os import os
from datetime import datetime, timezone, timedelta
from pyvulnerabilitylookup import PyVulnerabilityLookup from pyvulnerabilitylookup import PyVulnerabilityLookup
# NOTE: # NOTE:
@ -307,3 +309,36 @@ class TestPublic(unittest.TestCase):
self.assertTrue(len(comments['data']) == 0, comments) self.assertTrue(len(comments['data']) == 0, comments)
deleted_comment = self.client.delete_comment(new_comment_uuid) deleted_comment = self.client.delete_comment(new_comment_uuid)
self.assertTrue(deleted_comment < 300) self.assertTrue(deleted_comment < 300)
# test Sightings
def test_sightings(self) -> None:
sighting_cve = self.client.get_sighting('6febe45d-d8de-4df7-b3ba-6cf7acd2e2b5')
self.assertTrue(sighting_cve)
self.assertTrue('uuid' in sighting_cve)
self.assertEqual(sighting_cve['uuid'], '6febe45d-d8de-4df7-b3ba-6cf7acd2e2b5')
sighting_cve_list = self.client.get_sightings(sighting_uuid='6febe45d-d8de-4df7-b3ba-6cf7acd2e2b5')
self.assertTrue(sighting_cve_list)
self.assertTrue('data' in sighting_cve_list)
self.assertTrue(len(sighting_cve_list['data']) == 1)
self.assertEqual(sighting_cve_list['data'][0], sighting_cve)
sighting_cve_list = self.client.get_sightings(vuln_id='CVE-2020-3532')
self.assertTrue(sighting_cve_list)
self.assertTrue('data' in sighting_cve_list)
self.assertTrue(len(sighting_cve_list['data']) > 0)
sighting_cve_list = self.client.get_sightings(author='automation')
self.assertTrue(sighting_cve_list)
self.assertTrue('data' in sighting_cve_list)
self.assertTrue(len(sighting_cve_list['data']) > 0)
sighting_cve_list = self.client.get_sightings(author='automation', vuln_id='CVE-2020-3532')
self.assertTrue(sighting_cve_list)
self.assertTrue('data' in sighting_cve_list)
self.assertTrue(len(sighting_cve_list['data']) > 0)
sighting_cve_list = self.client.get_sightings(author='automation', date_from=datetime.now(tz=timezone.utc) - timedelta(days=1), date_to=datetime.now(tz=timezone.utc))
self.assertTrue(sighting_cve_list)
self.assertTrue('data' in sighting_cve_list)
self.assertTrue(len(sighting_cve_list['data']) > 0)