-
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 integration tests for
CollaborationAllowlistEntries
and `…
…Weblinks` (box/box-codegen#475) (#84)
- Loading branch information
1 parent
a6f2230
commit e072840
Showing
9 changed files
with
91 additions
and
9 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": "b3fc516", "specHash": "1698c95", "version": "0.1.0" } | ||
{ "engineHash": "cb5120c", "specHash": "1698c95", "version": "0.1.0" } |
27 changes: 27 additions & 0 deletions
27
Tests/CollaborationAllowlistEntries/CollaborationAllowlistEntriesManagerTests.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,27 @@ | ||
import Foundation | ||
import BoxSdkGen | ||
import XCTest | ||
|
||
class CollaborationAllowlistEntriesManagerTests: XCTestCase { | ||
var client: BoxClient! | ||
|
||
override func setUp() async throws { | ||
client = CommonsManager().getDefaultClient() | ||
} | ||
|
||
public func testCollaborationAllowlistEntries() async throws { | ||
let allowlist: CollaborationAllowlistEntries = try await client.collaborationAllowlistEntries.getCollaborationWhitelistEntries() | ||
XCTAssertTrue(allowlist.entries!.count >= 0) | ||
let domain: String = "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") | ||
XCTAssertTrue(newEntry.domain == domain) | ||
let entry: CollaborationAllowlistEntry = try await client.collaborationAllowlistEntries.getCollaborationWhitelistEntryById(collaborationWhitelistEntryId: newEntry.id!) | ||
XCTAssertTrue(entry.id == newEntry.id) | ||
XCTAssertTrue(Utils.Strings.toString(value: entry.direction) == Utils.Strings.toString(value: newEntry.direction)) | ||
XCTAssertTrue(entry.domain == domain) | ||
try await client.collaborationAllowlistEntries.deleteCollaborationWhitelistEntryById(collaborationWhitelistEntryId: entry.id!) | ||
await XCTAssertThrowsErrorAsync(try await client.collaborationAllowlistEntries.getCollaborationWhitelistEntryById(collaborationWhitelistEntryId: entry.id!)) | ||
} | ||
} |
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
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,34 @@ | ||
import Foundation | ||
import BoxSdkGen | ||
import XCTest | ||
|
||
class WeblinksManagerTests: XCTestCase { | ||
var client: BoxClient! | ||
|
||
override func setUp() async throws { | ||
client = CommonsManager().getDefaultClient() | ||
} | ||
|
||
public func testCreateGetDeleteWeblink() async throws { | ||
let url: String = "https://www.box.com" | ||
let parent: FolderFull = try await client.folders.getFolderById(folderId: "0") | ||
let name: String = Utils.getUUID() | ||
let description: String = "Weblink description" | ||
let password: String = "super-secret-password" | ||
let weblink: WebLink = try await client.webLinks.createWebLink(requestBody: CreateWebLinkRequestBody(url: url, parent: CreateWebLinkRequestBodyParentField(id: parent.id), name: name, description: description)) | ||
XCTAssertTrue(weblink.url == url) | ||
XCTAssertTrue(weblink.parent!.id == parent.id) | ||
XCTAssertTrue(weblink.name == name) | ||
XCTAssertTrue(weblink.description == description) | ||
let weblinkById: WebLink = try await client.webLinks.getWebLinkById(webLinkId: weblink.id) | ||
XCTAssertTrue(weblinkById.id == weblink.id) | ||
XCTAssertTrue(weblinkById.url == url) | ||
let updatedName: String = Utils.getUUID() | ||
let updatedWeblink: WebLink = try await client.webLinks.updateWebLinkById(webLinkId: weblink.id, requestBody: UpdateWebLinkByIdRequestBody(name: updatedName, sharedLink: UpdateWebLinkByIdRequestBodySharedLinkField(access: UpdateWebLinkByIdRequestBodySharedLinkAccessField.open, password: password))) | ||
XCTAssertTrue(updatedWeblink.name == updatedName) | ||
XCTAssertTrue(Utils.Strings.toString(value: updatedWeblink.sharedLink!.access!) == "open") | ||
try await client.webLinks.deleteWebLinkById(webLinkId: weblink.id) | ||
let deletedWeblink: WebLink = try await client.webLinks.getWebLinkById(webLinkId: weblink.id) | ||
XCTAssertTrue(Utils.Strings.toString(value: deletedWeblink.itemStatus!) == "trashed") | ||
} | ||
} |
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