def test_handle_login_response_wrong_credentials_throws(self): session = LeapSession() with (open(sampledatadir + "failed_login_result.html", "rb")) as f: failed_login = f.read() with self.assertRaises(IOError) as context: session._LeapSession__handle_login_response( failed_login, 'usernam') self.assertTrue( 'Your credentials are incorrect' in str(context.exception))
def test_handle_login_response_good_response_returns_true(self): session = LeapSession() with (open(sampledatadir + "login_result.html", "rb")) as f: good_login = f.read() loginOk = session._LeapSession__handle_login_response( good_login, 'usernam') self.assertTrue(loginOk)
def test_handle_login_response_good_response_returns_true(self): session = LeapSession() with (open(pickledir + "login_result.dat", "rb")) as f: good_login = pickle.load(f) loginOk = session._LeapSession__handle_login_response( good_login, 'usernam') self.assertTrue(loginOk)