Skip to content

Commit 0124335

Browse files
committed
Update tests
Signed-off-by: Tushar Goel <[email protected]>
1 parent 3c83b4c commit 0124335

24 files changed

+222
-148
lines changed

tests/types/conan-test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@
343343
"test_group": "base",
344344
"test_type": "validation",
345345
"input": "pkg:conan/openssl.org/[email protected]?arch=x86_64&build_type=Debug&compiler=Visual Studio&compiler.runtime=MDd&compiler.version=16&os=Windows&prev=b429db8a0e324114c25ec387bfd8281f330d7c5c&rrev=93a82349c31917d2d674d22065c7a9ef9f380c8e&shared=True",
346-
"expected_output": null
346+
"expected_output": []
347347
},
348348
{
349349
"description": "Valid Conan package with only namespace and no qualifiers",

tests/types/conda-test.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,30 +117,33 @@
117117
"test_group": "base",
118118
"test_type": "validation",
119119
"input": "pkg:conda/[email protected]",
120-
"expected_messages": []
120+
"expected_output": []
121121
},
122122
{
123123
"description": "Valid Conda package with full qualifiers (build, channel, subdir, type)",
124124
"test_group": "base",
125125
"test_type": "validation",
126126
"input": "pkg:conda/[email protected]?build=py36h06a4308_0&channel=main&subdir=linux-64&type=tar.bz2",
127-
"expected_messages": []
127+
"expected_output": []
128128
},
129129
{
130130
"description": "Conda package with namespace (not allowed)",
131131
"test_group": "advanced",
132132
"test_type": "validation",
133133
"input": "pkg:conda/anaconda/[email protected]",
134-
"expected_messages": [
135-
"Namespace is prohibited for purl type: 'conda'"
134+
"expected_output": [
135+
{
136+
"severity": "error",
137+
"message": "Namespace is prohibited for purl type: 'conda'"
138+
}
136139
]
137140
},
138141
{
139142
"description": "Conda package with unsupported qualifier",
140143
"test_group": "advanced",
141144
"test_type": "validation",
142145
"input": "pkg:conda/[email protected]?foo=bar",
143-
"expected_messages": null
146+
"expected_output": []
144147
}
145148
]
146149
}

tests/types/cpan-test.json

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -561,69 +561,78 @@
561561
"test_group": "base",
562562
"test_type": "validation",
563563
"input": "pkg:cpan/Perl::[email protected]",
564-
"expected_messages": null
564+
"expected_output": []
565565
},
566566
{
567567
"description": "Valid CPAN distribution with uppercase namespace (author ID)",
568568
"test_group": "base",
569569
"test_type": "validation",
570570
"input": "pkg:cpan/DROLSKY/[email protected]",
571-
"expected_messages": null
571+
"expected_output": []
572572
},
573573
{
574574
"description": "Valid CPAN distribution without version",
575575
"test_group": "base",
576576
"test_type": "validation",
577577
"input": "pkg:cpan/GDT/URI-PackageURL",
578-
"expected_messages": null
578+
"expected_output": []
579579
},
580580
{
581581
"description": "Valid CPAN module with :: in name and no namespace",
582582
"test_group": "base",
583583
"test_type": "validation",
584584
"input": "pkg:cpan/LWP::UserAgent",
585-
"expected_messages": []
585+
"expected_output": []
586586
},
587587
{
588588
"description": "CPAN distribution with lowercase namespace (must be uppercase)",
589589
"test_group": "base",
590590
"test_type": "validation",
591591
"input": "pkg:cpan/oalders/[email protected]",
592-
"expected_messages": [
593-
"Namespace must be uppercase for purl type: 'cpan'"
592+
"expected_output": [
593+
{
594+
"severity": "warning",
595+
"message": "Namespace must be uppercase for purl type: 'cpan'"
596+
}
594597
]
595598
},
596599
{
597600
"description": "CPAN distribution with lowercase namespace (must be uppercase)",
598601
"test_group": "advanced",
599602
"test_type": "validation",
600603
"input": "pkg:cpan/oalders/[email protected]",
601-
"expected_messages": null
604+
"expected_output": []
602605
},
603606
{
604607
"description": "CPAN module with '-' in name (not allowed without namespace)",
605608
"test_group": "base",
606609
"test_type": "validation",
607610
"input": "pkg:cpan/[email protected]",
608-
"expected_messages": [
609-
"Name must not contain '-' when Namespace is absent for purl type: 'cpan'"
611+
"expected_output": [
612+
{
613+
"severity": "error",
614+
"message": "Name must not contain '-' when Namespace is absent for purl type: 'cpan'"
615+
}
610616
]
611617
},
612618
{
613619
"description": "CPAN distribution name containing '::' (not allowed with namespace)",
614620
"test_group": "advanced",
615621
"test_type": "validation",
616622
"input": "pkg:cpan/TESTUSER/Bad::[email protected]",
617-
"expected_messages": [
618-
"Name must not contain '::' when Namespace is absent for purl type: 'cpan'"
623+
"expected_output": [
624+
{
625+
"severity": "error",
626+
"message": "Name must not contain '::' when Namespace is present for purl type: 'cpan'"
627+
}
619628
]
620629
},
621630
{
622631
"description": "Valid CPAN package with qualifiers (repository_url, download_url, vcs_url)",
623632
"test_group": "advanced",
624633
"test_type": "validation",
625634
"input": "pkg:cpan/OALDERS/[email protected]?download_url=https://cpan.metacpan.org/authors/id/O/OA/OALDERS/libwww-perl-6.76.tar.gz&ext=tar.gz&repository_url=https://cpan.metacpan.org&vcs_url=https://github.com/libwww-perl",
626-
"expected_messages": []
635+
"expected_output": []
627636
}
628637
]
629638
}

tests/types/cran-test.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,29 +247,32 @@
247247
"test_group": "base",
248248
"test_type": "validation",
249249
"input": "pkg:cran/[email protected]",
250-
"expected_messages": []
250+
"expected_output": []
251251
},
252252
{
253253
"description": "Valid CRAN package with hyphen in version",
254254
"test_group": "base",
255255
"test_type": "validation",
256256
"input": "pkg:cran/[email protected]",
257-
"expected_messages": []
257+
"expected_output": []
258258
},
259259
{
260260
"description": "Valid CRAN package with complex version",
261261
"test_group": "base",
262262
"test_type": "validation",
263263
"input": "pkg:cran/[email protected]",
264-
"expected_messages": []
264+
"expected_output": []
265265
},
266266
{
267267
"description": "CRAN package with namespace (not allowed)",
268268
"test_group": "base",
269269
"test_type": "validation",
270270
"input": "pkg:cran/ml/[email protected]",
271-
"expected_messages": [
272-
"Namespace is prohibited for purl type: 'cran'"
271+
"expected_output": [
272+
{
273+
"severity": "error",
274+
"message": "Namespace is prohibited for purl type: 'cran'"
275+
}
273276
]
274277
}
275278
]

tests/types/deb-test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
"test_group": "base",
292292
"test_type": "validation",
293293
"input": "pkg:deb/debian/[email protected]?arch=i386&distro=jessie",
294-
"expected_output": null
294+
"expected_output": []
295295
},
296296
{
297297
"description": "Valid deb package with vendor, name, version, without distro",

tests/types/gem-test.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,35 +146,35 @@
146146
"test_group": "base",
147147
"test_type": "validation",
148148
"input": "pkg:gem/[email protected]",
149-
"expected_messages": []
149+
"expected_output": []
150150
},
151151
{
152152
"description": "Valid RubyGem with java platform",
153153
"test_group": "base",
154154
"test_type": "validation",
155155
"input": "pkg:gem/[email protected]?platform=java",
156-
"expected_messages": []
156+
"expected_output": []
157157
},
158158
{
159159
"description": "Subpath included",
160160
"test_group": "base",
161161
"test_type": "validation",
162162
"input": "pkg:gem/[email protected]#lib/nokogiri.rb",
163-
"expected_messages": []
163+
"expected_output": []
164164
},
165165
{
166166
"description": "Extra unknown qualifier",
167167
"test_group": "base",
168168
"test_type": "validation",
169169
"input": "pkg:gem/[email protected]?unknown=value",
170-
"expected_messages": null
170+
"expected_output": []
171171
},
172172
{
173173
"description": "Extra unknown qualifier",
174174
"test_group": "advanced",
175175
"test_type": "validation",
176176
"input": "pkg:gem/[email protected]?unknown=value",
177-
"expected_messages": null
177+
"expected_output": []
178178
}
179179
]
180180
}

tests/types/generic-test.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,42 +139,42 @@
139139
"test_group": "base",
140140
"test_type": "validation",
141141
"input": "pkg:generic/[email protected]",
142-
"expected_messages": []
142+
"expected_output": []
143143
},
144144
{
145145
"description": "Valid generic package with download_url and checksum",
146146
"test_group": "base",
147147
"test_type": "validation",
148148
"input": "pkg:generic/[email protected]?checksum=sha256:de4d501267da&download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz",
149-
"expected_messages": []
149+
"expected_output": []
150150
},
151151
{
152152
"description": "Valid generic package with vcs_url",
153153
"test_group": "base",
154154
"test_type": "validation",
155155
"input": "pkg:generic/bitwarderl?vcs_url=git+https://git.fsfe.org/dxtr/bitwarderl@cc55108da32",
156-
"expected_messages": null
156+
"expected_output": []
157157
},
158158
{
159159
"description": "Extra unknown qualifier",
160160
"test_group": "advanced",
161161
"test_type": "validation",
162162
"input": "pkg:generic/[email protected]?foo=bar",
163-
"expected_messages": null
163+
"expected_output": []
164164
},
165165
{
166166
"description": "Subpath included",
167167
"test_group": "base",
168168
"test_type": "validation",
169169
"input": "pkg:generic/[email protected]#src/libexample.c",
170-
"expected_messages": []
170+
"expected_output": []
171171
},
172172
{
173173
"description": "Missing version and no qualifiers",
174174
"test_group": "advanced",
175175
"test_type": "validation",
176176
"input": "pkg:generic/noversionpkg",
177-
"expected_messages": []
177+
"expected_output": []
178178
}
179179
]
180180
}

tests/types/github-test.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,25 @@
138138
"test_group": "base",
139139
"test_type": "validation",
140140
"input": "pkg:github/package-url/purl-spec@244fd47e07d1004",
141-
"expected_messages": []
141+
"expected_output": []
142142
},
143143
{
144144
"description": "Valid GitHub package with subpath",
145145
"test_group": "base",
146146
"test_type": "validation",
147147
"input": "pkg:github/package-url/purl-spec@244fd47e07d1004#everybody/loves/dogs",
148-
"expected_messages": []
148+
"expected_output": []
149149
},
150150
{
151151
"description": "GitHub package missing namespace",
152152
"test_group": "advanced",
153153
"test_type": "validation",
154154
"input": "pkg:github/purl-spec@244fd47e07d1004",
155-
"expected_messages": [
156-
"Namespace is required for purl type: 'github'"
155+
"expected_output": [
156+
{
157+
"severity": "error",
158+
"message": "Namespace is required for purl type: 'github'"
159+
}
157160
]
158161
}
159162
]

tests/types/golang-test.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,38 +229,44 @@
229229
"test_group": "base",
230230
"test_type": "validation",
231231
"input": "pkg:golang/github.com/gorilla/context@234fd47e07d1004f0aed9c",
232-
"expected_messages": []
232+
"expected_output": []
233233
},
234234
{
235235
"description": "Valid golang package with namespace and name only (no version)",
236236
"test_group": "base",
237237
"test_type": "validation",
238238
"input": "pkg:golang/golang.org/x/crypto",
239-
"expected_messages": []
239+
"expected_output": []
240240
},
241241
{
242242
"description": "Valid golang package with subpath",
243243
"test_group": "advanced",
244244
"test_type": "validation",
245245
"input": "pkg:golang/google.golang.org/genproto#googleapis/api/annotations",
246-
"expected_messages": []
246+
"expected_output": []
247247
},
248248
{
249249
"description": "Golang package with uppercase namespace",
250250
"test_group": "base",
251251
"test_type": "validation",
252252
"input": "pkg:golang/GitHub.com/Gorilla/context@234fd47e07d1004f0aed9c",
253-
"expected_messages": [
254-
"Namespace is not lowercased for purl type: 'golang'"
253+
"expected_output": [
254+
{
255+
"severity": "warning",
256+
"message": "Namespace is not lowercased for purl type: 'golang'"
257+
}
255258
]
256259
},
257260
{
258261
"description": "Golang package with missing namespace",
259262
"test_group": "base",
260263
"test_type": "validation",
261264
"input": "pkg:golang/context@234fd47e07d1004f0aed9c",
262-
"expected_messages": [
263-
"Namespace is required for purl type: 'golang'"
265+
"expected_output": [
266+
{
267+
"severity": "error",
268+
"message": "Namespace is required for purl type: 'golang'"
269+
}
264270
]
265271
}
266272
]

0 commit comments

Comments
 (0)