Skip to content

Commit d36f12d

Browse files
committed
Add tests
Signed-off-by: Tushar Goel <[email protected]>
1 parent a7c1e2d commit d36f12d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
8+
#
9+
10+
from django.test import TestCase
11+
12+
from vulnerabilities.forms import CVEForm
13+
from vulnerabilities.models import Vulnerability
14+
15+
16+
class TestCVEForm(TestCase):
17+
def setUp(self) -> None:
18+
vuln1 = Vulnerability.objects.create(summary="test-vuln1", vulnerability_id="VCID-1234")
19+
self.id = vuln1.id
20+
21+
def test_cve_form(self):
22+
form = CVEForm(data={"vuln_id": "vcid-1234"})
23+
assert form.is_valid()
24+
25+
def test_client(self):
26+
response = self.client.get(f"/vulnerabilities/{self.id}?vuln_id=vcid-1234")
27+
self.assertContains(response, "test-vuln1", status_code=200)

0 commit comments

Comments
 (0)