Skip to content

Commit

Permalink
Add basic WWWAuthenticate test
Browse files Browse the repository at this point in the history
  • Loading branch information
edigaryev committed May 3, 2022
1 parent 0f31aba commit f21d4ce
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/TartTests/WWWAuthenticateTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import XCTest
@testable import tart

final class WWWAuthenticateTests: XCTestCase {
func testExample() throws {
// Test example from Token Authentication Specification[1]
//
// [1]: https://docs.docker.com/registry/spec/auth/token/
let wwwAuthenticate = try WWWAuthenticate(rawHeaderValue: "Bearer realm=\"https://auth.docker.io/token\",service=\"registry.docker.io\",scope=\"repository:samalba/my-app:pull,push\"")

XCTAssertEqual("Bearer", wwwAuthenticate.scheme)
XCTAssertEqual([
"realm": "https://auth.docker.io/token",
"service": "registry.docker.io",
"scope": "repository:samalba/my-app:pull,push",
], wwwAuthenticate.kvs)
}
}

0 comments on commit f21d4ce

Please sign in to comment.