Skip to content

Commit b5ce877

Browse files
committed
Add tests
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent a7c1e2d commit b5ce877

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from django.test import TestCase
2+
from rest_framework import status
3+
4+
from vulnerabilities.forms import CVEForm
5+
from vulnerabilities.models import Vulnerability
6+
7+
8+
class TestCVEForm(TestCase):
9+
def setUp(self) -> None:
10+
vuln1 = Vulnerability.objects.create(summary="test-vuln1", vulnerability_id="VCID-1234")
11+
self.id = vuln1.id
12+
13+
def test_cve_form(self):
14+
form = CVEForm(data={"vuln_id": "vcid-1234"})
15+
assert form.is_valid()
16+
17+
def test_client(self):
18+
response = self.client.get(f"/vulnerabilities/{self.id}?vuln_id=vcid-1234")
19+
self.assertContains(response, "test-vuln1", status_code=200)

0 commit comments

Comments
 (0)