I'm writing an iOS app with Swift, and we are using Parse for our backend. I'm working on some acceptance tests, and have mocked the Parse API using OHHTTPStubs.
I'm writing a test that taps through our login form and logs in a given user. In the view controller, we are calling the PFUser.logInWithUsernameInBackground
function. Inside the completion block, I'm calling println(PFUser.currentUser())
, and I can see that it is set correctly.
However, when I call println(PFUser.currentUser())
from my test case, it is still nil. I want to make sure that the user is being signed in, and that their username is correct.
The tests are application tests which are injected into the host application, and are written with KIF. I think the tests may contain their own separate PFUser
singleton instance, so I need to figure out how to gain access to the currentUser()
inside the main app.
Is there any way I can tell my tests to use the PFUser
class from the main app?
If this is usually supposed to work out of the box, what kind of mistakes should I look for in my code? (e.g. bridging headers, build settings, etc.)
Aucun commentaire:
Enregistrer un commentaire