def test_verify_email(self): # If an email is given to the constructor, return a successful result. verifier = MockVerifier('*****@*****.**') result = verifier.verify('asdf', 'http://testserver') ok_(result) eq_(result.audience, 'http://testserver') eq_(result.email, '*****@*****.**')
def test_verify_called_with_extra_kwargs(self): backend = BrowserIDBackend() verifier = MockVerifier('*****@*****.**') verifier.verify = Mock(wraps=verifier.verify) backend.get_verifier = lambda: verifier backend.authenticate(assertion='asdf', audience='http://testserver', foo='bar') verifier.verify.assert_called_with('asdf', 'http://testserver', foo='bar')
def test_verify_result_attributes(self): # Extra kwargs to the constructor are added to the result. verifier = MockVerifier('*****@*****.**', foo='bar', baz=5) result = verifier.verify('asdf', 'http://testserver') eq_(result.foo, 'bar') eq_(result.baz, 5)
def test_verify_no_email(self): # If the given email is None, verify should return a failure result. verifier = MockVerifier(None) result = verifier.verify('asdf', 'http://testserver') ok_(not result) eq_(result.reason, 'No email given to MockVerifier.')