| 1 | { |
| 2 | "$schema": "https://packageurl.org/schemas/purl-test.schema-0.1.json", |
| 3 | "tests": [ |
| 4 | { |
| 5 | "description": "a scheme is always required", |
| 6 | "test_group": "base", |
| 7 | "test_type": "parse", |
| 8 | "input": "[email protected]", |
| 9 | "expected_output": null, |
| 10 | "expected_failure": true, |
| 11 | "expected_failure_reason": "Should fail to parse a PURL from invalid purl input" |
| 12 | }, |
| 13 | { |
| 14 | "description": "a scheme is always required", |
| 15 | "test_group": "base", |
| 16 | "test_type": "parse", |
| 17 | "input": "[email protected]", |
| 18 | "expected_output": null, |
| 19 | "expected_failure": true, |
| 20 | "expected_failure_reason": "Should fail to parse a PURL from invalid canonical purl input" |
| 21 | }, |
| 22 | { |
| 23 | "description": "a type is always required", |
| 24 | "test_group": "base", |
| 25 | "test_type": "parse", |
| 26 | "input": "pkg:[email protected]", |
| 27 | "expected_output": null, |
| 28 | "expected_failure": true, |
| 29 | "expected_failure_reason": "Should fail to parse a PURL from invalid purl input" |
| 30 | }, |
| 31 | { |
| 32 | "description": "a type is always required", |
| 33 | "test_group": "base", |
| 34 | "test_type": "parse", |
| 35 | "input": "pkg:[email protected]", |
| 36 | "expected_output": null, |
| 37 | "expected_failure": true, |
| 38 | "expected_failure_reason": "Should fail to parse a PURL from invalid canonical purl input" |
| 39 | }, |
| 40 | { |
| 41 | "description": "a type is always required", |
| 42 | "test_group": "base", |
| 43 | "test_type": "build", |
| 44 | "input": { |
| 45 | "type": null, |
| 46 | "namespace": null, |
| 47 | "name": "EnterpriseLibrary.Common", |
| 48 | "version": "6.0.1304", |
| 49 | "qualifiers": null, |
| 50 | "subpath": null |
| 51 | }, |
| 52 | "expected_output": null, |
| 53 | "expected_failure": true, |
| 54 | "expected_failure_reason": "Should fail to build a PURL from invalid input components" |
| 55 | }, |
| 56 | { |
| 57 | "description": "check for invalid character in type", |
| 58 | "test_group": "base", |
| 59 | "test_type": "parse", |
| 60 | "input": "pkg:n&g?inx/[email protected]", |
| 61 | "expected_output": null, |
| 62 | "expected_failure": true, |
| 63 | "expected_failure_reason": "Should fail to parse a PURL from invalid purl input" |
| 64 | }, |
| 65 | { |
| 66 | "description": "check for null type", |
| 67 | "test_group": "base", |
| 68 | "test_type": "build", |
| 69 | "input": { |
| 70 | "type": null, |
| 71 | "namespace": null, |
| 72 | "name": "nginx", |
| 73 | "version": "0.8.9", |
| 74 | "qualifiers": null, |
| 75 | "subpath": null |
| 76 | }, |
| 77 | "expected_output": null, |
| 78 | "expected_failure": true, |
| 79 | "expected_failure_reason": "Should fail to build a PURL from null type" |
| 80 | }, |
| 81 | { |
| 82 | "description": "check for type that starts with number", |
| 83 | "test_group": "base", |
| 84 | "test_type": "parse", |
| 85 | "input": "pkg:3nginx/[email protected]", |
| 86 | "expected_output": null, |
| 87 | "expected_failure": true, |
| 88 | "expected_failure_reason": "Should fail to parse a PURL from invalid purl type (cannot start with number)" |
| 89 | }, |
| 90 | { |
| 91 | "description": "check for type that starts with number", |
| 92 | "test_group": "base", |
| 93 | "test_type": "build", |
| 94 | "input": { |
| 95 | "type": null, |
| 96 | "namespace": null, |
| 97 | "name": "nginx", |
| 98 | "version": "0.8.9", |
| 99 | "qualifiers": null, |
| 100 | "subpath": null |
| 101 | }, |
| 102 | "expected_output": null, |
| 103 | "expected_failure": true, |
| 104 | "expected_failure_reason": "Should fail to build a PURL from invalid input components" |
| 105 | }, |
| 106 | { |
| 107 | "description": "check for colon in type", |
| 108 | "test_group": "base", |
| 109 | "test_type": "parse", |
| 110 | "input": "pkg:nginx:a/[email protected]", |
| 111 | "expected_output": null, |
| 112 | "expected_failure": true, |
| 113 | "expected_failure_reason": "Should fail to parse a PURL from invalid purl input" |
| 114 | }, |
| 115 | { |
| 116 | "description": "check for colon in type", |
| 117 | "test_group": "base", |
| 118 | "test_type": "build", |
| 119 | "input": { |
| 120 | "type": null, |
| 121 | "namespace": null, |
| 122 | "name": "nginx", |
| 123 | "version": "0.8.9", |
| 124 | "qualifiers": null, |
| 125 | "subpath": null |
| 126 | }, |
| 127 | "expected_output": null, |
| 128 | "expected_failure": true, |
| 129 | "expected_failure_reason": "Should fail to build a PURL from invalid input components" |
| 130 | }, |
| 131 | { |
| 132 | "description": "checks for invalid qualifier keys", |
| 133 | "test_group": "base", |
| 134 | "test_type": "parse", |
| 135 | "input": "pkg:npm/[email protected]?in%20production=true", |
| 136 | "expected_output": null, |
| 137 | "expected_failure": true, |
| 138 | "expected_failure_reason": "Should fail to parse a PURL from invalid purl input" |
| 139 | }, |
| 140 | { |
| 141 | "description": "checks for invalid qualifier keys", |
| 142 | "test_group": "base", |
| 143 | "test_type": "build", |
| 144 | "input": { |
| 145 | "type": "npm", |
| 146 | "namespace": null, |
| 147 | "name": "myartifact", |
| 148 | "version": "1.0.0", |
| 149 | "qualifiers": { |
| 150 | "in production": "true" |
| 151 | }, |
| 152 | "subpath": null |
| 153 | }, |
| 154 | "expected_output": null, |
| 155 | "expected_failure": true, |
| 156 | "expected_failure_reason": "Should fail to build a PURL from invalid input components" |
| 157 | }, |
| 158 | { |
| 159 | "description": "a name is required", |
| 160 | "test_group": "base", |
| 161 | "test_type": "parse", |
| 162 | "input": "pkg:maven/@1.3.4", |
| 163 | "expected_output": null, |
| 164 | "expected_failure": true, |
| 165 | "expected_failure_reason": "Should fail to parse a PURL from invalid purl input" |
| 166 | }, |
| 167 | { |
| 168 | "description": "a name is required", |
| 169 | "test_group": "base", |
| 170 | "test_type": "build", |
| 171 | "input": { |
| 172 | "type": "maven", |
| 173 | "namespace": null, |
| 174 | "name": null, |
| 175 | "version": null, |
| 176 | "qualifiers": null, |
| 177 | "subpath": null |
| 178 | }, |
| 179 | "expected_output": null, |
| 180 | "expected_failure": true, |
| 181 | "expected_failure_reason": "Should fail to build a PURL from invalid input components" |
| 182 | }, |
| 183 | { |
| 184 | "description": "invalid encoded colon : between scheme and type", |
| 185 | "test_group": "base", |
| 186 | "test_type": "parse", |
| 187 | "input": "pkg%3Amaven/org.apache.commons/io", |
| 188 | "expected_output": null, |
| 189 | "expected_failure": true, |
| 190 | "expected_failure_reason": "Should fail to parse a PURL from invalid purl input" |
| 191 | }, |
| 192 | { |
| 193 | "description": "Build with multiple checksum", |
| 194 | "test_group": "base", |
| 195 | "test_type": "build", |
| 196 | "input": { |
| 197 | "type": "generic", |
| 198 | "namespace": null, |
| 199 | "name": "openssl", |
| 200 | "version": "1.1.10g", |
| 201 | "qualifiers": { |
| 202 | "checksum": "sha1:ad9503c3e994a4f,sha256:41bf9088b3a1e6c1ef1d" |
| 203 | }, |
| 204 | "subpath": null |
| 205 | }, |
| 206 | "expected_output": "pkg:generic/[email protected]?checksum=sha1:ad9503c3e994a4f%2Csha256:41bf9088b3a1e6c1ef1d", |
| 207 | "expected_failure": false, |
| 208 | "expected_failure_reason": null |
| 209 | }, |
| 210 | { |
| 211 | "description": "Roundtrip with multiple checksum", |
| 212 | "test_group": "base", |
| 213 | "test_type": "roundtrip", |
| 214 | "input": "pkg:generic/bitwarderl?checksum=sha1:ad9503c3e994a4f%2Csha256:41bf9088b3a1e6c1ef1d", |
| 215 | "expected_output": "pkg:generic/bitwarderl?checksum=sha1:ad9503c3e994a4f%2Csha256:41bf9088b3a1e6c1ef1d", |
| 216 | "expected_failure": false, |
| 217 | "expected_failure_reason": null |
| 218 | } |
| 219 | ] |
| 220 | } |