Skip to content

Commit

Permalink
test: Fix collaboration allowlist entries test (box/box-codegen#521) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build authored Jul 2, 2024
1 parent b3fd5bf commit c224417
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "74a3b04", "specHash": "fc01415", "version": "0.3.0" }
{ "engineHash": "62a25a4", "specHash": "e95d6fa", "version": "0.3.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ public class SignRequestCreateSigner: Codable {
/// declined redirect URL settings for a specific signer.
public let declinedRedirectUrl: String?

/// If set to true, signer will need to login to a Box account
/// If set to true, the signer will need to log in to a Box account
/// before signing the request. If the signer does not have
/// an existing account, they will have an option to create
/// a free Box account.
/// an existing account, they will have the option to create
/// a free Box account. Cannot be selected in combination with
/// `verification_phone_number`.
public let loginRequired: Bool?

/// If set, this phone number is be used to verify the signer
/// via two factor authentication before they are able to sign the document.
/// If set, this phone number will be used to verify the signer
/// via two-factor authentication before they are able to sign the document.
/// Cannot be selected in combination with `login_required`.
public let verificationPhoneNumber: String?

/// If set, the signer is required to enter the password before they are able
Expand Down Expand Up @@ -103,12 +105,14 @@ public class SignRequestCreateSigner: Codable {
/// to after declining to sign a document.
/// Defining this URL overrides default or global
/// declined redirect URL settings for a specific signer.
/// - loginRequired: If set to true, signer will need to login to a Box account
/// - loginRequired: If set to true, the signer will need to log in to a Box account
/// before signing the request. If the signer does not have
/// an existing account, they will have an option to create
/// a free Box account.
/// - verificationPhoneNumber: If set, this phone number is be used to verify the signer
/// via two factor authentication before they are able to sign the document.
/// an existing account, they will have the option to create
/// a free Box account. Cannot be selected in combination with
/// `verification_phone_number`.
/// - verificationPhoneNumber: If set, this phone number will be used to verify the signer
/// via two-factor authentication before they are able to sign the document.
/// Cannot be selected in combination with `login_required`.
/// - password: If set, the signer is required to enter the password before they are able
/// to sign a document. This field is write only.
/// - signerGroupId: If set, signers who have the same value will be assigned to the same input and to the same signer group.
Expand Down
12 changes: 7 additions & 5 deletions Sources/Schemas/SignRequestSigner/SignRequestSigner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ public class SignRequestSigner: SignRequestCreateSigner {
/// to after declining to sign a document.
/// Defining this URL overrides default or global
/// declined redirect URL settings for a specific signer.
/// - loginRequired: If set to true, signer will need to login to a Box account
/// - loginRequired: If set to true, the signer will need to log in to a Box account
/// before signing the request. If the signer does not have
/// an existing account, they will have an option to create
/// a free Box account.
/// - verificationPhoneNumber: If set, this phone number is be used to verify the signer
/// via two factor authentication before they are able to sign the document.
/// an existing account, they will have the option to create
/// a free Box account. Cannot be selected in combination with
/// `verification_phone_number`.
/// - verificationPhoneNumber: If set, this phone number will be used to verify the signer
/// via two-factor authentication before they are able to sign the document.
/// Cannot be selected in combination with `login_required`.
/// - password: If set, the signer is required to enter the password before they are able
/// to sign a document. This field is write only.
/// - signerGroupId: If set, signers who have the same value will be assigned to the same input and to the same signer group.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CollaborationAllowlistEntriesManagerTests: XCTestCase {
public func testCollaborationAllowlistEntries() async throws {
let allowlist: CollaborationAllowlistEntries = try await client.collaborationAllowlistEntries.getCollaborationWhitelistEntries()
XCTAssertTrue(allowlist.entries!.count >= 0)
let domain: String = "example.com"
let domain: String = "\(Utils.getUUID())\("example.com")"
let newEntry: CollaborationAllowlistEntry = try await client.collaborationAllowlistEntries.createCollaborationWhitelistEntry(requestBody: CreateCollaborationWhitelistEntryRequestBody(domain: domain, direction: CreateCollaborationWhitelistEntryRequestBodyDirectionField.inbound))
XCTAssertTrue(Utils.Strings.toString(value: newEntry.type) == "collaboration_whitelist_entry")
XCTAssertTrue(Utils.Strings.toString(value: newEntry.direction) == "inbound")
Expand Down
4 changes: 2 additions & 2 deletions Tests/FileMetadata/FileMetadataManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class FileMetadataManagerTests: XCTestCase {
XCTAssertTrue(Utils.Strings.toString(value: createdMetadata.scope) == "global")
XCTAssertTrue(createdMetadata.version == 0)
let receivedMetadata: MetadataFull = try await client.fileMetadata.getFileMetadataById(fileId: file.id, scope: GetFileMetadataByIdScope.global, templateKey: "properties")
XCTAssertTrue(receivedMetadata.extraData!["abc"] == "xyz")
XCTAssertTrue(Utils.Strings.toString(value: receivedMetadata.extraData!["abc"]) == "xyz")
let newValue: String = "bar"
try await client.fileMetadata.updateFileMetadataById(fileId: file.id, scope: UpdateFileMetadataByIdScope.global, templateKey: "properties", requestBody: [UpdateFileMetadataByIdRequestBody(op: UpdateFileMetadataByIdRequestBodyOpField.replace, path: "/abc", value: newValue)])
let receivedUpdatedMetadata: MetadataFull = try await client.fileMetadata.getFileMetadataById(fileId: file.id, scope: GetFileMetadataByIdScope.global, templateKey: "properties")
XCTAssertTrue(receivedUpdatedMetadata.extraData!["abc"] == newValue)
XCTAssertTrue(Utils.Strings.toString(value: receivedUpdatedMetadata.extraData!["abc"]) == newValue)
try await client.fileMetadata.deleteFileMetadataById(fileId: file.id, scope: DeleteFileMetadataByIdScope.global, templateKey: "properties")
await XCTAssertThrowsErrorAsync(try await client.fileMetadata.getFileMetadataById(fileId: file.id, scope: GetFileMetadataByIdScope.global, templateKey: "properties"))
try await client.files.deleteFileById(fileId: file.id)
Expand Down
4 changes: 2 additions & 2 deletions Tests/FolderMetadata/FolderMetadataManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class FolderMetadataManagerTests: XCTestCase {
XCTAssertTrue(Utils.Strings.toString(value: createdMetadata.scope) == "global")
XCTAssertTrue(createdMetadata.version == 0)
let receivedMetadata: MetadataFull = try await client.folderMetadata.getFolderMetadataById(folderId: folder.id, scope: GetFolderMetadataByIdScope.global, templateKey: "properties")
XCTAssertTrue(receivedMetadata.extraData!["abc"] == "xyz")
XCTAssertTrue(Utils.Strings.toString(value: receivedMetadata.extraData!["abc"]) == "xyz")
let newValue: String = "bar"
try await client.folderMetadata.updateFolderMetadataById(folderId: folder.id, scope: UpdateFolderMetadataByIdScope.global, templateKey: "properties", requestBody: [UpdateFolderMetadataByIdRequestBody(op: UpdateFolderMetadataByIdRequestBodyOpField.replace, path: "/abc", value: newValue)])
let receivedUpdatedMetadata: MetadataFull = try await client.folderMetadata.getFolderMetadataById(folderId: folder.id, scope: GetFolderMetadataByIdScope.global, templateKey: "properties")
XCTAssertTrue(receivedUpdatedMetadata.extraData!["abc"] == newValue)
XCTAssertTrue(Utils.Strings.toString(value: receivedUpdatedMetadata.extraData!["abc"]) == newValue)
try await client.folderMetadata.deleteFolderMetadataById(folderId: folder.id, scope: DeleteFolderMetadataByIdScope.global, templateKey: "properties")
await XCTAssertThrowsErrorAsync(try await client.folderMetadata.getFolderMetadataById(folderId: folder.id, scope: GetFolderMetadataByIdScope.global, templateKey: "properties"))
try await client.folders.deleteFolderById(folderId: folder.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class MetadataCascadePoliciesManagerTests: XCTestCase {
let policies: MetadataCascadePolicies = try await client.metadataCascadePolicies.getMetadataCascadePolicies(queryParams: GetMetadataCascadePoliciesQueryParams(folderId: folder.id))
XCTAssertTrue(policies.entries!.count == 1)
await XCTAssertThrowsErrorAsync(try await client.metadataCascadePolicies.applyMetadataCascadePolicy(metadataCascadePolicyId: cascadePolicyId, requestBody: ApplyMetadataCascadePolicyRequestBody(conflictResolution: ApplyMetadataCascadePolicyRequestBodyConflictResolutionField.overwrite)))
let data: [String: String] = ["testName": "xyz"]
try await client.folderMetadata.createFolderMetadataById(folderId: folder.id, scope: CreateFolderMetadataByIdScope.enterprise, templateKey: templateKey, requestBody: data)
try await client.folderMetadata.createFolderMetadataById(folderId: folder.id, scope: CreateFolderMetadataByIdScope.enterprise, templateKey: templateKey, requestBody: ["testName": "xyz"])
try await client.metadataCascadePolicies.applyMetadataCascadePolicy(metadataCascadePolicyId: cascadePolicyId, requestBody: ApplyMetadataCascadePolicyRequestBody(conflictResolution: ApplyMetadataCascadePolicyRequestBodyConflictResolutionField.overwrite))
try await client.metadataCascadePolicies.deleteMetadataCascadePolicyById(metadataCascadePolicyId: cascadePolicyId)
await XCTAssertThrowsErrorAsync(try await client.metadataCascadePolicies.getMetadataCascadePolicyById(metadataCascadePolicyId: cascadePolicyId))
Expand Down

0 comments on commit c224417

Please sign in to comment.