Skip to content

Commit

Permalink
Add test for specifying profile name
Browse files Browse the repository at this point in the history
  • Loading branch information
andres97medrano committed Jan 25, 2024
1 parent db60ae3 commit 6071d80
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
curl \
--request POST \
--header "Accept: application/json" \
--header "Authorization: Bearer jsonWebToken" \
--header "Content-Type: application/json" \
--data "{\"data\":{\"attributes\":{\"name\":\"mySpecialProfile\",\"profileType\":\"profileType\"},\"type\":\"profiles\",\"relationships\":{\"devices\":{\"data\":[{\"id\":\"deviceId\",\"type\":\"devices\"}]},\"certificates\":{\"data\":[{\"id\":\"certificateId\",\"type\":\"certificates\"}]},\"bundleId\":{\"data\":{\"id\":\"bundleId\",\"type\":\"bundleIds\"}}}}}" \
"https://api.appstoreconnect.apple.com/v1/profiles"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
▿ CreateProfileResponse
▿ data: CreateProfileResponseData
▿ attributes: Attributes
- createdDate: 1970-01-01T00:00:00Z
- expirationDate: 1970-01-01T00:01:40Z
- name: "createdProfileName"
- platform: "platform"
- profileContent: "dGVzdAo="
- profileState: "profileState"
- profileType: "profileType"
- uuid: "uuid"
- id: "createdProfileITCID"
- type: "type"
30 changes: 30 additions & 0 deletions Tests/SignHereLibraryTests/iTunesConnectServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,36 @@ final class iTunesConnectServiceTests: XCTestCase {
)
}

func test_createProfile_withProfileName() throws {
// GIVEN
let jsonEncoder: JSONEncoder = createJSONEncoder()
var networkExecutes: [Data] = [
try jsonEncoder.encode(createCreateProfileResponse()),
]
network.executeHandler = { _ in
return networkExecutes.removeFirst()
}

// WHEN
let value: CreateProfileResponse = try subject.createProfile(
jsonWebToken: "jsonWebToken",
bundleId: "bundleId",
certificateId: "certificateId",
deviceIDs: .init(["deviceId"]),
profileType: "profileType",
profileName: "mySpecialProfile"
)

// THEN
for argValue in network.executeArgValues {
assertSnapshot(matching: argValue, as: .curl)
}
assertSnapshot(
matching: value,
as: .dump
)
}

func test_createProfile_iosAppStoreProfile() throws {
// GIVEN
let jsonEncoder: JSONEncoder = createJSONEncoder()
Expand Down

0 comments on commit 6071d80

Please sign in to comment.