Last active
June 1, 2016 20:39
-
-
Save armstrongnate/f01f81b3c8d24329c8742392cd7c21f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func testDeleteFolder() { | |
attempt { | |
let session = Session.nas | |
var response: JSONObject? | |
stub(session, "delete-folder") { expectation in | |
try! Folder.deleteFolder(session, folderID: "10396915") | |
.startWithCompletedExpectation(expectation) { value in | |
response = value | |
} | |
} | |
XCTAssertNotNil(response, "it should get a successful response") | |
} | |
} |
This file contains hidden or 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
func testDeleteFolder() { | |
attempt { | |
let session = Session.art | |
let request = try! FileNodeAPI.deleteFolder(session, folderID: "1") | |
XCTAssertEqual("/api/v1/folders/1", request.URL?.relativePath, "url matches") | |
XCTAssertEqual("DELETE", request.HTTPMethod, "it is a DELETE request") | |
} | |
} |
This file contains hidden or 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
func testNewFolder() { | |
attempt { | |
let session = Session.nas | |
let context = try session.filesManagedObjectContext() | |
assertDifference({ Folder.count(inContext: context) }, 1) { | |
self.stub(session, "add-folder") { expectation in | |
Folder.newFolder(session, folderID: "10119415", name: "Folder") | |
.startWithCompletedExpectation(expectation) { _ in } | |
} | |
guard let folder = try? Folder.findOne(withValue: "10119415", forKey: "parentFolderID", inContext: context) else { | |
XCTFail("Expected a folder") | |
return | |
} | |
XCTAssertEqual("Folder 7", folder.name) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment