def test_verify_with_invalid_code(self): auth = self.mocker.mock() auth.get_access_token(mocker.ARGS) self.mocker.throw(TweepError("error")) self.mocker.replay() account = TwitterAccount("[email protected]/Adium123") account._auth = auth verified = account.verify("code") self.mocker.verify() assert not verified assert not account.verified assert account.authenticating
def test_verify_with_valid_code(self): auth = self.mocker.mock() auth.get_access_token(mocker.ARGS) tweepy = self.mocker.replace("tweepy") tweepy.API(mocker.ARGS) self.mocker.result("api_instance") self.mocker.replay() account = TwitterAccount("[email protected]/Adium123") account._auth = auth verified = account.verify("code") self.mocker.verify() assert verified assert account.verified assert not account.authenticating