Skip to content

Commit 4a6a643

Browse files
committed
Change input to purl string
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent d55e6a7 commit 4a6a643

32 files changed

Lines changed: 211 additions & 1555 deletions

tests/types/alpm-test.json

Lines changed: 9 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -140,96 +140,44 @@
140140
"description": "Valid alpm package with arch qualifier",
141141
"test_group": "base",
142142
"test_type": "validation",
143-
"input": {
144-
"type": "alpm",
145-
"namespace": "arch",
146-
"name": "pacman",
147-
"version": "6.0.1-1",
148-
"qualifiers": {
149-
"arch": "x86_64"
150-
},
151-
"subpath": null
152-
},
143+
"input": "pkg:alpm/arch/pacman@6.0.1-1?arch=x86_64",
153144
"expected_messages": null
154145
},
155146
{
156147
"description": "alpm package with uppercase nmamespace",
157148
"test_group": "base",
158149
"test_type": "validation",
159-
"input": {
160-
"type": "alpm",
161-
"namespace": "Arch",
162-
"name": "pacman",
163-
"version": "6.0.1-1",
164-
"qualifiers": {
165-
"arch": "x86_64"
166-
},
167-
"subpath": null
168-
},
169-
"expected_messages": ["Namespace is not lowercased for purl type: 'alpm'"]
150+
"input": "pkg:alpm/Arch/pacman@6.0.1-1?arch=x86_64",
151+
"expected_messages": [
152+
"Namespace is not lowercased for purl type: 'alpm'"
153+
]
170154
},
171155
{
172156
"description": "alpm package with uppercase nmamespace (advanced)",
173157
"test_group": "advanced",
174158
"test_type": "validation",
175-
"input": {
176-
"type": "alpm",
177-
"namespace": "Arch",
178-
"name": "pacman",
179-
"version": "6.0.1-1",
180-
"qualifiers": {
181-
"arch": "x86_64"
182-
},
183-
"subpath": null
184-
},
159+
"input": "pkg:alpm/Arch/pacman@6.0.1-1?arch=x86_64",
185160
"expected_messages": null
186161
},
187162
{
188163
"description": "Valid alpm package with 'any' arch",
189164
"test_group": "base",
190165
"test_type": "validation",
191-
"input": {
192-
"type": "alpm",
193-
"namespace": "arch",
194-
"name": "python-pip",
195-
"version": "21.0-1",
196-
"qualifiers": {
197-
"arch": "any"
198-
},
199-
"subpath": null
200-
},
166+
"input": "pkg:alpm/arch/python-pip@21.0-1?arch=any",
201167
"expected_messages": null
202168
},
203169
{
204170
"description": "Valid alpm package with epoch in version",
205171
"test_group": "advanced",
206172
"test_type": "validation",
207-
"input": {
208-
"type": "alpm",
209-
"namespace": "arch",
210-
"name": "containers-common",
211-
"version": "1:0.47.4-4",
212-
"qualifiers": {
213-
"arch": "x86_64"
214-
},
215-
"subpath": null
216-
},
173+
"input": "pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64",
217174
"expected_messages": null
218175
},
219176
{
220177
"description": "alpm package missing namespace",
221178
"test_group": "base",
222179
"test_type": "validation",
223-
"input": {
224-
"type": "alpm",
225-
"namespace": null,
226-
"name": "pacman",
227-
"version": "6.0.1-1",
228-
"qualifiers": {
229-
"arch": "x86_64"
230-
},
231-
"subpath": null
232-
},
180+
"input": "pkg:alpm/pacman@6.0.1-1?arch=x86_64",
233181
"expected_messages": [
234182
"Namespace is required for purl type: 'alpm'"
235183
]

tests/types/apk-test.json

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -95,64 +95,28 @@
9595
"description": "Valid apk package with arch qualifier",
9696
"test_group": "base",
9797
"test_type": "validation",
98-
"input": {
99-
"type": "apk",
100-
"namespace": "alpine",
101-
"name": "curl",
102-
"version": "7.83.0-r0",
103-
"qualifiers": {
104-
"arch": "x86"
105-
},
106-
"subpath": null
107-
},
98+
"input": "pkg:apk/alpine/curl@7.83.0-r0?arch=x86",
10899
"expected_messages": null
109100
},
110101
{
111102
"description": "Valid apk package with higher version and arch qualifier",
112103
"test_group": "base",
113104
"test_type": "validation",
114-
"input": {
115-
"type": "apk",
116-
"namespace": "alpine",
117-
"name": "apk",
118-
"version": "2.12.9-r3",
119-
"qualifiers": {
120-
"arch": "x86"
121-
},
122-
"subpath": null
123-
},
105+
"input": "pkg:apk/alpine/apk@2.12.9-r3?arch=x86",
124106
"expected_messages": null
125107
},
126108
{
127109
"description": "Valid apk package with openwrt vendor",
128110
"test_group": "advanced",
129111
"test_type": "validation",
130-
"input": {
131-
"type": "apk",
132-
"namespace": "openwrt",
133-
"name": "busybox",
134-
"version": "1.35.0-r5",
135-
"qualifiers": {
136-
"arch": "mips"
137-
},
138-
"subpath": null
139-
},
112+
"input": "pkg:apk/openwrt/busybox@1.35.0-r5?arch=mips",
140113
"expected_messages": null
141114
},
142115
{
143116
"description": "apk package missing namespace",
144117
"test_group": "base",
145118
"test_type": "validation",
146-
"input": {
147-
"type": "apk",
148-
"namespace": null,
149-
"name": "curl",
150-
"version": "7.83.0-r0",
151-
"qualifiers": {
152-
"arch": "x86"
153-
},
154-
"subpath": null
155-
},
119+
"input": "pkg:apk/curl@7.83.0-r0?arch=x86",
156120
"expected_messages": [
157121
"Namespace is required for purl type: 'apk'"
158122
]
@@ -161,16 +125,7 @@
161125
"description": "apk package with uppercase namespace and name",
162126
"test_group": "base",
163127
"test_type": "validation",
164-
"input": {
165-
"type": "apk",
166-
"namespace": "FOO",
167-
"name": "BAR",
168-
"version": "7.83.0-r0",
169-
"qualifiers": {
170-
"arch": "x86"
171-
},
172-
"subpath": null
173-
},
128+
"input": "pkg:apk/FOO/BAR@7.83.0-r0?arch=x86",
174129
"expected_messages": [
175130
"Namespace is not lowercased for purl type: 'apk'",
176131
"Name is not lowercased for purl type: 'apk'"
@@ -180,16 +135,7 @@
180135
"description": "apk package with uppercase namespace and name (advanced)",
181136
"test_group": "advanced",
182137
"test_type": "validation",
183-
"input": {
184-
"type": "apk",
185-
"namespace": "FOO",
186-
"name": "BAR",
187-
"version": "7.83.0-r0",
188-
"qualifiers": {
189-
"arch": "x86"
190-
},
191-
"subpath": null
192-
},
138+
"input": "pkg:apk/FOO/BAR@7.83.0-r0?arch=x86",
193139
"expected_messages": null
194140
}
195141
]

tests/types/bitbucket-test.json

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -96,62 +96,28 @@
9696
"description": "Valid Bitbucket package with commit hash as version",
9797
"test_group": "base",
9898
"test_type": "validation",
99-
"input": {
100-
"type": "bitbucket",
101-
"namespace": "birkenfeld",
102-
"name": "pygments-main",
103-
"version": "244fd47e07d1014f0aed9c",
104-
"qualifiers": null,
105-
"subpath": null
106-
},
99+
"input": "pkg:bitbucket/birkenfeld/pygments-main@244fd47e07d1014f0aed9c",
107100
"expected_messages": null
108101
},
109102
{
110103
"description": "Valid Bitbucket package with subpath",
111104
"test_group": "base",
112105
"test_type": "validation",
113-
"input": {
114-
"type": "bitbucket",
115-
"namespace": "teamname",
116-
"name": "repo-name",
117-
"version": "1.0.0",
118-
"qualifiers": null,
119-
"subpath": "src/main"
120-
},
106+
"input": "pkg:bitbucket/teamname/repo-name@1.0.0#src/main",
121107
"expected_messages": null
122108
},
123109
{
124110
"description": "Valid Bitbucket package with qualifiers",
125111
"test_group": "base",
126112
"test_type": "validation",
127-
"input": {
128-
"type": "bitbucket",
129-
"namespace": "company",
130-
"name": "service",
131-
"version": "release-2024",
132-
"qualifiers": {
133-
"arch": "x86_64",
134-
"os": "linux"
135-
},
136-
"subpath": null
137-
},
113+
"input": "pkg:bitbucket/company/service@release-2024?arch=x86_64&os=linux",
138114
"expected_messages": null
139115
},
140116
{
141117
"description": "Valid Bitbucket package with qualifiers",
142118
"test_group": "advanced",
143119
"test_type": "validation",
144-
"input": {
145-
"type": "bitbucket",
146-
"namespace": "company",
147-
"name": "service",
148-
"version": "release-2024",
149-
"qualifiers": {
150-
"arch": "x86_64",
151-
"os": "linux"
152-
},
153-
"subpath": null
154-
},
120+
"input": "pkg:bitbucket/company/service@release-2024?arch=x86_64&os=linux",
155121
"expected_messages": null
156122
}
157123
]

tests/types/bitnami-test.json

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -189,66 +189,28 @@
189189
"description": "Valid Bitnami package without version",
190190
"test_group": "base",
191191
"test_type": "validation",
192-
"input": {
193-
"type": "bitnami",
194-
"namespace": null,
195-
"name": "wordpress",
196-
"version": null,
197-
"qualifiers": {
198-
"distro": "debian-12"
199-
},
200-
"subpath": null
201-
},
192+
"input": "pkg:bitnami/wordpress?distro=debian-12",
202193
"expected_messages": null
203194
},
204195
{
205196
"description": "Valid Bitnami package with version and distro",
206197
"test_group": "base",
207198
"test_type": "validation",
208-
"input": {
209-
"type": "bitnami",
210-
"namespace": null,
211-
"name": "wordpress",
212-
"version": "6.2.0",
213-
"qualifiers": {
214-
"distro": "debian-12"
215-
},
216-
"subpath": null
217-
},
199+
"input": "pkg:bitnami/wordpress@6.2.0?distro=debian-12",
218200
"expected_messages": null
219201
},
220202
{
221203
"description": "Valid Bitnami package with arch and distro",
222204
"test_group": "advanced",
223205
"test_type": "validation",
224-
"input": {
225-
"type": "bitnami",
226-
"namespace": null,
227-
"name": "wordpress",
228-
"version": "6.2.0",
229-
"qualifiers": {
230-
"arch": "arm64",
231-
"distro": "debian-12"
232-
},
233-
"subpath": null
234-
},
206+
"input": "pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=debian-12",
235207
"expected_messages": null
236208
},
237209
{
238210
"description": "Valid Bitnami package with another distro",
239211
"test_group": "advanced",
240212
"test_type": "validation",
241-
"input": {
242-
"type": "bitnami",
243-
"namespace": null,
244-
"name": "wordpress",
245-
"version": "6.2.0",
246-
"qualifiers": {
247-
"arch": "arm64",
248-
"distro": "photon-4"
249-
},
250-
"subpath": null
251-
},
213+
"input": "pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=photon-4",
252214
"expected_messages": null
253215
}
254216
]

0 commit comments

Comments
 (0)