[Swift] Handle String responses

This commit is contained in:
Jason Gavris
2016-08-23 10:15:47 -04:00
parent 3a457c6a7e
commit e89f914e8b
5 changed files with 63 additions and 36 deletions

View File

@@ -28,19 +28,12 @@ class UserAPITests: XCTestCase {
let expectation = self.expectationWithDescription("testLogin")
UserAPI.loginUser(username: "swiftTester", password: "swift") { (_, error) in
// The server isn't returning JSON - and currently the alamofire implementation
// always parses responses as JSON, so making an exception for this here
guard let error = error else {
guard error == nil else {
XCTFail("error logging in")
return
}
switch error {
case ErrorResponse.Error(200, _, _):
expectation.fulfill()
default:
XCTFail("error logging in")
}
expectation.fulfill()
}
self.waitForExpectationsWithTimeout(testTimeout, handler: nil)