in Sources/PackageRegistryCompatibilityTestSuite/APITests/DownloadSourceArchive.swift [31:64]
func run() async {
for fixture in self.configuration.sourceArchives {
let scope = fixture.packageRelease.package.scope
let name = fixture.packageRelease.package.name
let version = fixture.packageRelease.version
self.log.append(await self.run(scope: scope, name: name, version: version, fixture: fixture))
// Case-insensitivity
self.log.append(await self.run(scope: scope.flipcased, name: name.flipcased, version: version.flipcased, fixture: fixture))
}
for packageRelease in self.configuration.unknownSourceArchives {
self.log.append(await TestCase(name: "Fetch source archive for unknown package release \(packageRelease.package.scope).\(packageRelease.package.name)@\(packageRelease.version)") { testCase in
let url = "\(self.registryURL)/\(packageRelease.package.scope)/\(packageRelease.package.name)/\(packageRelease.version).zip"
testCase.mark("HTTP request: GET \(url)")
let response = try await self.get(url: url, mediaType: .zip)
// 4.4 Server should return 404 if package release archive is not found
testCase.mark("HTTP response status")
guard response.status == .notFound else {
throw TestError("Expected HTTP status code 404 but got \(response.status.code)")
}
// 3.3 Server should communicate errors using "problem details" object
testCase.mark("Response body")
if response.body == nil {
testCase.warning("Response should include problem details")
}
})
}
self.printLog()
}