Skip to content

Commit 4970e5a

Browse files
committed
Fix tests according to new schema
Signed-off-by: Tushar Goel <[email protected]>
1 parent f01b357 commit 4970e5a

File tree

9 files changed

+104
-56
lines changed

9 files changed

+104
-56
lines changed

tests/types/alpm-test.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,45 +141,51 @@
141141
"test_group": "base",
142142
"test_type": "validation",
143143
"input": "pkg:alpm/arch/[email protected]?arch=x86_64",
144-
"expected_messages": null
144+
"expected_output": []
145145
},
146146
{
147147
"description": "alpm package with uppercase nmamespace",
148148
"test_group": "base",
149149
"test_type": "validation",
150150
"input": "pkg:alpm/Arch/[email protected]?arch=x86_64",
151-
"expected_messages": [
152-
"Namespace is not lowercased for purl type: 'alpm'"
151+
"expected_output": [
152+
{
153+
"severity": "warning",
154+
"message": "Namespace is not lowercased for purl type: 'alpm'"
155+
}
153156
]
154157
},
155158
{
156159
"description": "alpm package with uppercase nmamespace (advanced)",
157160
"test_group": "advanced",
158161
"test_type": "validation",
159162
"input": "pkg:alpm/Arch/[email protected]?arch=x86_64",
160-
"expected_messages": null
163+
"expected_output": []
161164
},
162165
{
163166
"description": "Valid alpm package with 'any' arch",
164167
"test_group": "base",
165168
"test_type": "validation",
166169
"input": "pkg:alpm/arch/[email protected]?arch=any",
167-
"expected_messages": null
170+
"expected_output": []
168171
},
169172
{
170173
"description": "Valid alpm package with epoch in version",
171174
"test_group": "advanced",
172175
"test_type": "validation",
173176
"input": "pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64",
174-
"expected_messages": null
177+
"expected_output": []
175178
},
176179
{
177180
"description": "alpm package missing namespace",
178181
"test_group": "base",
179182
"test_type": "validation",
180183
"input": "pkg:alpm/[email protected]?arch=x86_64",
181-
"expected_messages": [
182-
"Namespace is required for purl type: 'alpm'"
184+
"expected_output": [
185+
{
186+
"severity": "error",
187+
"message": "Namespace is required for purl type: 'alpm'"
188+
}
183189
]
184190
}
185191
]

tests/types/apk-test.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,47 +96,56 @@
9696
"test_group": "base",
9797
"test_type": "validation",
9898
"input": "pkg:apk/alpine/[email protected]?arch=x86",
99-
"expected_messages": null
99+
"expected_output": []
100100
},
101101
{
102102
"description": "Valid apk package with higher version and arch qualifier",
103103
"test_group": "base",
104104
"test_type": "validation",
105105
"input": "pkg:apk/alpine/[email protected]?arch=x86",
106-
"expected_messages": null
106+
"expected_output": []
107107
},
108108
{
109109
"description": "Valid apk package with openwrt vendor",
110110
"test_group": "advanced",
111111
"test_type": "validation",
112112
"input": "pkg:apk/openwrt/[email protected]?arch=mips",
113-
"expected_messages": null
113+
"expected_output": []
114114
},
115115
{
116116
"description": "apk package missing namespace",
117117
"test_group": "base",
118118
"test_type": "validation",
119119
"input": "pkg:apk/[email protected]?arch=x86",
120-
"expected_messages": [
121-
"Namespace is required for purl type: 'apk'"
120+
"expected_output": [
121+
{
122+
"severity": "error",
123+
"message": "Namespace is required for purl type: 'apk'"
124+
}
122125
]
123126
},
124127
{
125128
"description": "apk package with uppercase namespace and name",
126129
"test_group": "base",
127130
"test_type": "validation",
128131
"input": "pkg:apk/FOO/[email protected]?arch=x86",
129-
"expected_messages": [
130-
"Namespace is not lowercased for purl type: 'apk'",
131-
"Name is not lowercased for purl type: 'apk'"
132+
"expected_output": [
133+
{
134+
"severity": "warning",
135+
"message": "Namespace is not lowercased for purl type: 'apk'"
136+
},
137+
{
138+
"severity": "warning",
139+
"message": "Name is not lowercased for purl type: 'apk'"
140+
}
132141
]
133142
},
134143
{
135144
"description": "apk package with uppercase namespace and name (advanced)",
136145
"test_group": "advanced",
137146
"test_type": "validation",
138147
"input": "pkg:apk/FOO/[email protected]?arch=x86",
139-
"expected_messages": null
148+
"expected_output": []
140149
}
141150
]
142151
}

tests/types/bitnami-test.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,28 +190,28 @@
190190
"test_group": "base",
191191
"test_type": "validation",
192192
"input": "pkg:bitnami/wordpress?distro=debian-12",
193-
"expected_messages": null
193+
"expected_output": []
194194
},
195195
{
196196
"description": "Valid Bitnami package with version and distro",
197197
"test_group": "base",
198198
"test_type": "validation",
199199
"input": "pkg:bitnami/[email protected]?distro=debian-12",
200-
"expected_messages": null
200+
"expected_output": []
201201
},
202202
{
203203
"description": "Valid Bitnami package with arch and distro",
204204
"test_group": "advanced",
205205
"test_type": "validation",
206206
"input": "pkg:bitnami/[email protected]?arch=arm64&distro=debian-12",
207-
"expected_messages": null
207+
"expected_output": []
208208
},
209209
{
210210
"description": "Valid Bitnami package with another distro",
211211
"test_group": "advanced",
212212
"test_type": "validation",
213213
"input": "pkg:bitnami/[email protected]?arch=arm64&distro=photon-4",
214-
"expected_messages": null
214+
"expected_output": []
215215
}
216216
]
217217
}

tests/types/cargo-test.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,29 +129,32 @@
129129
"test_group": "base",
130130
"test_type": "validation",
131131
"input": "pkg:cargo/[email protected]",
132-
"expected_messages": []
132+
"expected_output": []
133133
},
134134
{
135135
"description": "Valid Cargo package with another example",
136136
"test_group": "base",
137137
"test_type": "validation",
138138
"input": "pkg:cargo/[email protected]",
139-
"expected_messages": null
139+
"expected_output": []
140140
},
141141
{
142142
"description": "Cargo package without version",
143143
"test_group": "advanced",
144144
"test_type": "validation",
145145
"input": "pkg:cargo/structopt",
146-
"expected_messages": null
146+
"expected_output": []
147147
},
148148
{
149149
"description": "Cargo package with namespace (not allowed)",
150150
"test_group": "advanced",
151151
"test_type": "validation",
152152
"input": "pkg:cargo/rustlang/[email protected]",
153-
"expected_messages": [
154-
"Namespace is prohibited for purl type: 'cargo'"
153+
"expected_output": [
154+
{
155+
"severity": "error",
156+
"message": "Namespace is prohibited for purl type: 'cargo'"
157+
}
155158
]
156159
}
157160
]

tests/types/cocoapods-test.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,29 +170,32 @@
170170
"test_group": "base",
171171
"test_type": "validation",
172172
"input": "pkg:cocoapods/[email protected]",
173-
"expected_messages": []
173+
"expected_output": []
174174
},
175175
{
176176
"description": "Valid CocoaPods package with subspec in subpath",
177177
"test_group": "base",
178178
"test_type": "validation",
179179
"input": "pkg:cocoapods/[email protected]#NSData+zlib",
180-
"expected_messages": []
180+
"expected_output": []
181181
},
182182
{
183183
"description": "CocoaPods package without version",
184184
"test_group": "advanced",
185185
"test_type": "validation",
186186
"input": "pkg:cocoapods/MapsIndoors",
187-
"expected_messages": []
187+
"expected_output": []
188188
},
189189
{
190190
"description": "CocoaPods package with namespace (not allowed)",
191191
"test_group": "advanced",
192192
"test_type": "validation",
193193
"input": "pkg:cocoapods/apple/[email protected]#Twitter",
194-
"expected_messages": [
195-
"Namespace is prohibited for purl type: 'cocoapods'"
194+
"expected_output": [
195+
{
196+
"severity": "error",
197+
"message": "Namespace is prohibited for purl type: 'cocoapods'"
198+
}
196199
]
197200
}
198201
]

tests/types/composer-test.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,47 +122,56 @@
122122
"test_group": "base",
123123
"test_type": "validation",
124124
"input": "pkg:composer/laravel/[email protected]",
125-
"expected_messages": null
125+
"expected_output": []
126126
},
127127
{
128128
"description": "Composer package without version",
129129
"test_group": "base",
130130
"test_type": "validation",
131131
"input": "pkg:composer/symfony/console",
132-
"expected_messages": null
132+
"expected_output": []
133133
},
134134
{
135135
"description": "Composer package with uppercase namespace (should normalize to lowercase)",
136136
"test_group": "base",
137137
"test_type": "validation",
138138
"input": "pkg:composer/Laravel/[email protected]",
139-
"expected_messages": [
140-
"Namespace is not lowercased for purl type: 'composer'",
141-
"Name is not lowercased for purl type: 'composer'"
139+
"expected_output": [
140+
{
141+
"severity": "warning",
142+
"message": "Namespace is not lowercased for purl type: 'composer'"
143+
},
144+
{
145+
"severity": "warning",
146+
"message": "Name is not lowercased for purl type: 'composer'"
147+
}
142148
]
143149
},
144150
{
145151
"description": "Composer package with uppercase namespace (should normalize to lowercase)",
146152
"test_group": "advanced",
147153
"test_type": "validation",
148154
"input": "pkg:composer/Laravel/[email protected]",
149-
"expected_messages": null
155+
"expected_output": []
150156
},
151157
{
152158
"description": "Composer package missing namespace",
153159
"test_group": "base",
154160
"test_type": "validation",
155161
"input": "pkg:composer/[email protected]",
156-
"expected_messages": [
157-
"Namespace is required for purl type: 'composer'"
162+
"expected_output": [
163+
{
164+
"severity": "error",
165+
"message": "Namespace is required for purl type: 'composer'"
166+
}
158167
]
159168
},
160169
{
161170
"description": "Composer package with qualifiers",
162171
"test_group": "base",
163172
"test_type": "validation",
164173
"input": "pkg:composer/laravel/[email protected]?repository_url=https://packagist.org",
165-
"expected_messages": null
174+
"expected_output": []
166175
}
167176
]
168177
}

tests/types/conan-test.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,35 +329,40 @@
329329
"test_group": "base",
330330
"test_type": "validation",
331331
"input": "pkg:conan/[email protected]",
332-
"expected_messages": []
332+
"expected_output": []
333333
},
334334
{
335335
"description": "Valid Conan package with namespace (vendor) and qualifiers user+channel",
336336
"test_group": "base",
337337
"test_type": "validation",
338338
"input": "pkg:conan/openssl.org/[email protected]?channel=stable&user=bincrafters",
339-
"expected_messages": []
339+
"expected_output": []
340340
},
341341
{
342342
"description": "Valid Conan package with namespace, complex qualifiers including rrev and prev",
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_messages": null
346+
"expected_output": null
347347
},
348348
{
349349
"description": "Valid Conan package with only namespace and no qualifiers",
350350
"test_group": "base",
351351
"test_type": "validation",
352352
"input": "pkg:conan/openssl.org/[email protected]",
353-
"expected_messages": []
353+
"expected_output": []
354354
},
355355
{
356356
"description": "Conan package with unsupported qualifier key",
357357
"test_group": "advanced",
358358
"test_type": "validation",
359359
"input": "pkg:conan/[email protected]?foo=bar",
360-
"expected_messages": null
360+
"expected_output": [
361+
{
362+
"severity": "info",
363+
"message": "Invalid qualifiers found: arch, build_type, compiler, compiler.runtime, compiler.version, os, shared. Allowed qualifiers are: channel, prev, repository_url, rrev, user"
364+
}
365+
]
361366
}
362367
]
363368
}

tests/types/deb-test.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,37 +291,45 @@
291291
"test_group": "base",
292292
"test_type": "validation",
293293
"input": "pkg:deb/debian/[email protected]?arch=i386&distro=jessie",
294-
"expected_messages": null
294+
"expected_output": null
295295
},
296296
{
297297
"description": "Valid deb package with vendor, name, version, without distro",
298298
"test_group": "base",
299299
"test_type": "validation",
300300
"input": "pkg:deb/ubuntu/[email protected]?arch=amd64",
301-
"expected_messages": []
301+
"expected_output": []
302302
},
303303
{
304304
"description": "Valid deb source package",
305305
"test_group": "base",
306306
"test_type": "validation",
307307
"input": "pkg:deb/debian/attr@1:2.4.47-2?arch=source",
308-
"expected_messages": []
308+
"expected_output": []
309309
},
310310
{
311311
"description": "Deb package missing vendor",
312312
"test_group": "advanced",
313313
"test_type": "validation",
314314
"input": "pkg:deb/[email protected]?arch=amd64",
315-
"expected_messages": [
316-
"Namespace is required for purl type: 'deb'"
315+
"expected_output": [
316+
{
317+
"severity": "error",
318+
"message": "Namespace is required for purl type: 'deb'"
319+
}
317320
]
318321
},
319322
{
320323
"description": "deb package with unsupported qualifier",
321324
"test_group": "advanced",
322325
"test_type": "validation",
323326
"input": "pkg:deb/debian/[email protected]?foo=bar",
324-
"expected_messages": null
327+
"expected_output": [
328+
{
329+
"severity": "info",
330+
"message": "Invalid qualifiers found: distro. Allowed qualifiers are: arch, repository_url"
331+
}
332+
]
325333
}
326334
]
327335
}

0 commit comments

Comments
 (0)