mirror of
https://codeberg.org/secana/ForgejoKit.git
synced 2026-06-16 05:13:53 -07:00
- Add Attachment model with isImage computed property - Add assets field to Issue, IssueComment, and PullRequest - Add multipart/form-data upload support to ForgejoClient - Add uploadIssueAttachment and uploadCommentAttachment to IssueService
27 lines
965 B
Swift
27 lines
965 B
Swift
@testable import ForgejoKit
|
|
import Foundation
|
|
import Testing
|
|
|
|
struct BearerCredentialTests {
|
|
@Test func `bearer credential uses bearer scheme`() {
|
|
let client = ForgejoClient(
|
|
serverURL: "https://codeberg.org", username: "octocat", bearerToken: "abc123",
|
|
)
|
|
#expect(client.authorizationHeaderValue == "Bearer abc123")
|
|
}
|
|
|
|
@Test func `token credential still uses token scheme`() {
|
|
let client = ForgejoClient(
|
|
serverURL: "https://codeberg.org", username: "octocat", token: "abc123",
|
|
)
|
|
#expect(client.authorizationHeaderValue == "token abc123")
|
|
}
|
|
|
|
@Test func `basic credential uses basic scheme`() {
|
|
let client = ForgejoClient(
|
|
serverURL: "https://codeberg.org", username: "octocat", password: "pw",
|
|
)
|
|
let expected = "Basic " + Data("octocat:pw".utf8).base64EncodedString()
|
|
#expect(client.authorizationHeaderValue == expected)
|
|
}
|
|
}
|