-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for App item associations (box/box-codegen#561) (#221)
Co-authored-by: box-sdk-build <[email protected]>
- Loading branch information
1 parent
546f487
commit 43ea668
Showing
6 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "engineHash": "2994c4a", "specHash": "6ca858e", "version": "0.4.0" } | ||
{ "engineHash": "66f851a", "specHash": "6ca858e", "version": "0.4.0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Tests/AppItemAssociations/AppItemAssociationsManagerTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Foundation | ||
import BoxSdkGen | ||
import XCTest | ||
|
||
class AppItemAssociationsManagerTests: XCTestCase { | ||
|
||
public func testListFileAppItemAssocations() async throws { | ||
let client: BoxClient = CommonsManager().getDefaultClientWithUserSubject(userId: Utils.getEnvironmentVariable(name: "USER_ID")) | ||
let fileId: String = Utils.getEnvironmentVariable(name: "APP_ITEM_ASSOCIATION_FILE_ID") | ||
let fileAppItemAssociations: AppItemAssociations = try await client.appItemAssociations.getFileAppItemAssociations(fileId: fileId) | ||
XCTAssertTrue(fileAppItemAssociations.entries!.count == 1) | ||
let association: AppItemAssociation = fileAppItemAssociations.entries![0] | ||
XCTAssertTrue(association.id != "") | ||
XCTAssertTrue(Utils.Strings.toString(value: association.appItem.applicationType) == "hubs") | ||
XCTAssertTrue(Utils.Strings.toString(value: association.appItem.type) == "app_item") | ||
let file: FileFull = try await client.files.getFileById(fileId: fileId, queryParams: GetFileByIdQueryParams(fields: ["is_associated_with_app_item"])) | ||
XCTAssertTrue(file.isAssociatedWithAppItem! == true) | ||
} | ||
|
||
public func testListFolderAppItemAssocations() async throws { | ||
let client: BoxClient = CommonsManager().getDefaultClientWithUserSubject(userId: Utils.getEnvironmentVariable(name: "USER_ID")) | ||
let folderId: String = Utils.getEnvironmentVariable(name: "APP_ITEM_ASSOCIATION_FOLDER_ID") | ||
let folderAppItemAssociations: AppItemAssociations = try await client.appItemAssociations.getFolderAppItemAssociations(folderId: folderId) | ||
XCTAssertTrue(folderAppItemAssociations.entries!.count == 1) | ||
let association: AppItemAssociation = folderAppItemAssociations.entries![0] | ||
XCTAssertTrue(association.id != "") | ||
XCTAssertTrue(Utils.Strings.toString(value: association.appItem.applicationType) == "hubs") | ||
XCTAssertTrue(Utils.Strings.toString(value: association.appItem.type) == "app_item") | ||
let folder: FolderFull = try await client.folders.getFolderById(folderId: folderId, queryParams: GetFolderByIdQueryParams(fields: ["is_associated_with_app_item"])) | ||
XCTAssertTrue(folder.isAssociatedWithAppItem! == true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters