def test_failure(self): profile_data = {'error': 'some error'} self.get.return_value.status_code = 400 self.get.json.return_value = profile_data with pytest.raises(verify.IdentificationError): verify.get_fxa_profile('profile-plz', {}) self.get.assert_called_with('https://app.fxa/v1/profile', headers={ 'Authorization': 'Bearer profile-plz', })
def test_failure(self): profile_data = {'error': 'some error'} self.get.return_value.status_code = 400 self.get.json.return_value = profile_data with pytest.raises(verify.IdentificationError): verify.get_fxa_profile('profile-plz', { 'profile_host': 'https://app.fxa/v1', }) self.get.assert_called_with('https://app.fxa/v1/profile', headers={ 'Authorization': 'Bearer profile-plz', })
def test_success_no_email(self): profile_data = {'email': ''} self.get.return_value.status_code = 200 self.get.return_value.json.return_value = profile_data with pytest.raises(verify.IdentificationError): verify.get_fxa_profile('profile-plz', { 'profile_host': 'https://app.fxa/v1', }) self.get.assert_called_with('https://app.fxa/v1/profile', headers={ 'Authorization': 'Bearer profile-plz', })
def test_success(self): profile_data = {'email': '*****@*****.**'} self.get.return_value.status_code = 200 self.get.return_value.json.return_value = profile_data profile = verify.get_fxa_profile('profile-plz', {}) assert profile == profile_data self.get.assert_called_with('https://app.fxa/v1/profile', headers={ 'Authorization': 'Bearer profile-plz', })
def test_success(self): profile_data = {'email': '*****@*****.**'} self.get.return_value.status_code = 200 self.get.return_value.json.return_value = profile_data profile = verify.get_fxa_profile('profile-plz', { 'profile_host': 'https://app.fxa/v1', }) assert profile == profile_data self.get.assert_called_with('https://app.fxa/v1/profile', headers={ 'Authorization': 'Bearer profile-plz', })