     }
     
     
-    //TODO: test is failing because production login overriding test login
     func test_GetAllPhotonDevices_CallsDelegate()
     {
         let promise = expectation(description: "login")
         manager.login(user: Secret.TestEmail, password: Secret.TestPassword)
-        .then { _ -> Void in
-            self.manager.getAllPhotonDevices().then { _ -> Void in
+        .then { _ in
+            return self.manager.getAllPhotonDevices().then { _ -> Void in
                 XCTAssertEqual(self.deviceFound, "myphoton")
                 promise.fulfill()
             }
+        }.catch { error in
+            XCTFail()
         }
         waitForExpectations(timeout: 3)
     }

    {
        let promise = expectation(description: "login")
        manager.login(user: Secret.TestEmail, password: Secret.TestPassword)
        .then { _ -> Void in
            self.manager.discoverDevices().then { _ -> Void in
                XCTAssertEqual(self.deviceFound, "myphoton")
                promise.fulfill()
            }
        }
        waitForExpectations(timeout: 5)
    }

        .then { _ -> Void in
            XCTAssert(ParticleCloud.sharedInstance().isAuthenticated)
            promise.fulfill()
        }.catch { error in
            XCTFail()
        }
        waitForExpectations(timeout: 3)
    }
