示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 def test_all_good(self):
     self.get_fxa_token.return_value = get_fxa_token_data = {
         'access_token': 'cafe'
     }
     self.get_profile.return_value = {'email': '*****@*****.**'}
     identity, token_data = verify.fxa_identify('heya', self.CONFIG)
     assert identity == {'email': '*****@*****.**'}
     assert token_data == get_fxa_token_data
     self.get_fxa_token.assert_called_with(code='heya', config=self.CONFIG)
     self.get_profile.assert_called_with('cafe')
示例#6
0
 def test_with_id_token(self):
     self.get_token.return_value = {
         'access_token': 'cafe',
         'id_token': 'openidisawesome'
     }
     self.get_profile.return_value = {'email': '*****@*****.**'}
     identity = verify.fxa_identify('heya', self.CONFIG)
     assert identity == ({'email': '*****@*****.**'}, 'openidisawesome')
     self.get_token.assert_called_with('heya', self.CONFIG)
     self.get_profile.assert_called_with('cafe', self.CONFIG)
示例#7
0
 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
示例#8
0
 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