def test_profile_raises(self): self.get_token.return_value = {'access_token': 'bee5'} self.get_profile.side_effect = verify.IdentificationError with pytest.raises(verify.IdentificationError): verify.fxa_identify('heya', self.CONFIG) self.get_token.assert_called_with('heya', self.CONFIG) self.get_profile.assert_called_with('bee5', self.CONFIG)
def test_all_good(self): self.get_token.return_value = {'access_token': 'cafe'} self.get_profile.return_value = {'email': '*****@*****.**'} identity = verify.fxa_identify('heya', self.CONFIG) assert identity == {'email': '*****@*****.**'} self.get_token.assert_called_with('heya', self.CONFIG) self.get_profile.assert_called_with('cafe', self.CONFIG)
def test_token_raises(self): self.get_token.side_effect = verify.IdentificationError with pytest.raises(verify.IdentificationError): verify.fxa_identify('heya', self.CONFIG) self.get_token.assert_called_with('heya', self.CONFIG) assert not self.get_profile.called