1414
1515import pytest
1616
17- from vulnerabilities .pipelines .v2_importers .github_issue_pr import GithubPipelineIssuePR
17+ from vulnerabilities .pipelines .v2_importers .github_issue_pr import GithubPipelineIssuePRPipeline
1818from vulnerabilities .tests import util_tests
1919
20+ TEST_DATA = Path (__file__ ).parent .parent .parent / "test_data" / "github_issue_pr"
21+
2022
2123@pytest .fixture
2224def pipeline ():
23- pipeline = GithubPipelineIssuePR ()
25+ pipeline = GithubPipelineIssuePRPipeline ()
2426 pipeline .repo_url = "https://github.com/test/repo"
2527 pipeline .log = MagicMock ()
2628 return pipeline
@@ -32,44 +34,41 @@ def test_collect_issues_and_prs(pipeline):
3234 SimpleNamespace (
3335 title = "Fix for CVE-2023-1234 found" ,
3436 body = "This resolves a security issue" ,
35- html_url = "http ://example.com/issue1" ,
37+ html_url = "https ://example.com/issue1" ,
3638 ),
3739 SimpleNamespace (
3840 title = "No vulnerability mentioned" ,
3941 body = "This is unrelated" ,
40- html_url = "http ://example.com/issue2" ,
42+ html_url = "https ://example.com/issue2" ,
4143 ),
4244 ]
4345
4446 pipeline .pull_requestes = [
4547 SimpleNamespace (
4648 title = "Patch addressing GHSA-zzz-111" ,
4749 body = "Also fixes PYSEC-2024-5678" ,
48- html_url = "http ://example.com/pr1" ,
50+ html_url = "https ://example.com/pr1" ,
4951 )
5052 ]
5153
5254 result = pipeline .collect_issues_and_prs ()
5355 expected = {
54- "CVE-2023-1234" : [("Issue" , "http ://example.com/issue1" )],
55- "GHSA-zzz-111" : [("PR" , "http ://example.com/pr1" )],
56- "PYSEC-2024-5678" : [("PR" , "http ://example.com/pr1" )],
56+ "CVE-2023-1234" : [("Issue" , "https ://example.com/issue1" )],
57+ "GHSA-zzz-111" : [("PR" , "https ://example.com/pr1" )],
58+ "PYSEC-2024-5678" : [("PR" , "https ://example.com/pr1" )],
5759 }
5860
5961 assert result == expected
6062
6163
62- TEST_DATA = Path (__file__ ).parent .parent .parent / "test_data" / "github_issue_pr"
63-
64-
6564@pytest .mark .django_db
6665def test_collect_advisories_from_json ():
6766 input_file = TEST_DATA / "issues_and_pr.json"
6867 expected_file = TEST_DATA / "expected_advisory_output.json"
6968
7069 issues_and_prs = json .loads (input_file .read_text (encoding = "utf-8" ))
7170
72- pipeline = GithubPipelineIssuePR ()
71+ pipeline = GithubPipelineIssuePRPipeline ()
7372 pipeline .repo_url = "https://github.com/test/repo"
7473 pipeline .log = MagicMock ()
7574
0 commit comments