def setUpClass(self): # Populate OpenID config cache. with mock.patch('kinto.plugins.openid.utils.requests.get') as m: m.return_value.json.return_value = { 'userinfo_endpoint': 'http://uinfo', 'jwks_uri': 'https://jwks' } fetch_openid_config('https://fxa')
def setUpClass(self): # Populate OpenID config cache. with mock.patch("kinto.plugins.openid.utils.requests.get") as m: m.return_value.json.return_value = { "userinfo_endpoint": "http://uinfo", "jwks_uri": "https://jwks", } fetch_openid_config("https://fxa")
def setUpClass(self): # Populate OpenID config cache. with mock.patch("kinto.plugins.openid.utils.requests.get") as m: m.return_value.json.return_value = { "userinfo_endpoint": "http://uinfo", "jwks_uri": "https://jwks", } fetch_openid_config("https://fxa")
def test_profile_is_exposed(self): key = "openid:verify:444c6694937007bbf494f155f6cb12139db4c4c6a926742f3fe0bb4b5d191aa3" profile = {"sub": "abcd", "email": "*****@*****.**"} self.app.app.registry.cache.set(key, profile, ttl=30) with mock.patch("kinto.plugins.openid.utils.requests.get") as m: m.return_value.json.return_value = { "userinfo_endpoint": "http://uinfo", "jwks_uri": "https://jwks", } fetch_openid_config("https://fxa") resp = self.app.get("/", headers={"Authorization": "Bearer avrbnnbrbr"}) assert "profile" in resp.json["user"] assert resp.json["user"]["profile"] == { "sub": "abcd", "email": "*****@*****.**" }
def setUpClass(self): # Populate OpenID config cache. with mock.patch('kinto.plugins.openid.utils.requests.get') as m: m.return_value.json.return_value = {'userinfo_endpoint': 'http://uinfo', 'jwks_uri': 'https://jwks'} fetch_openid_config('https://fxa')