def test_fxa_config_anonymous(): request = RequestFactory().get('/en-US/firefox/addons') request.session = {'fxa_state': 'thestate!'} request.user = AnonymousUser() assert utils.fxa_config(request) == { 'clientId': 'foo', 'state': 'thestate!', 'oauthHost': 'https://accounts.firefox.com/oauth', 'redirectUrl': 'https://testserver/fxa', 'scope': 'profile', }
def test_fxa_config_anonymous(): request = RequestFactory().get("/en-US/firefox/addons") request.session = {"fxa_state": "thestate!"} request.user = AnonymousUser() assert utils.fxa_config(request) == { "clientId": "foo", "state": "thestate!", "oauthHost": "https://accounts.firefox.com/oauth", "redirectUrl": "https://testserver/fxa", "scope": "profile", }
def test_fxa_config_logged_in(): request = RequestFactory().get('/en-US/firefox/addons') request.session = {'fxa_state': 'thestate!'} request.user = UserProfile(email='*****@*****.**') assert utils.fxa_config(request) == { 'clientId': 'foo', 'state': 'thestate!', 'email': '*****@*****.**', 'oauthHost': 'https://accounts.firefox.com/oauth', 'redirectUrl': 'https://testserver/fxa', 'scope': 'profile', }
def test_fxa_config_anonymous(): request = RequestFactory().get('/en-US/firefox/addons') request.session = {'fxa_state': 'thestate!'} request.user = AnonymousUser() assert utils.fxa_config(request) == { 'clientId': 'foo', 'state': 'thestate!', 'oauthHost': 'https://oauth-stable.dev.lcip.org/v1', 'contentHost': 'https://stable.dev.lcip.org', 'profileHost': 'https://stable.dev.lcip.org/profile/v1', 'scope': 'profile openid', }
def test_fxa_config_logged_in(): request = RequestFactory().get("/en-US/firefox/addons") request.session = {"fxa_state": "thestate!"} request.user = UserProfile(email="*****@*****.**") assert utils.fxa_config(request) == { "clientId": "foo", "state": "thestate!", "email": "*****@*****.**", "oauthHost": "https://accounts.firefox.com/oauth", "redirectUrl": "https://testserver/fxa", "scope": "profile", }
def test_fxa_config_logged_in(): request = RequestFactory().get('/en-US/firefox/addons') request.session = {'fxa_state': 'thestate!'} request.user = UserProfile(email='*****@*****.**') assert utils.fxa_config(request) == { 'clientId': 'foo', 'state': 'thestate!', 'email': '*****@*****.**', 'oauthHost': 'https://oauth-stable.dev.lcip.org/v1', 'contentHost': 'https://stable.dev.lcip.org', 'profileHost': 'https://stable.dev.lcip.org/profile/v1', 'scope': 'profile openid', }
def fxa_config(context): return utils.fxa_config(context['request'])