Exemplo n.º 1
0
 def test_rsvp_not_firefox(self, rsvp_mock, gfpe_mock, gfot_mock):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides', HTTP_USER_AGENT='Safari')
     req.COOKIES['fxaOauthState'] = 'thedude'
     gfot_mock.return_value = 'atoken'
     gfpe_mock.return_value = '*****@*****.**'
     views.oauth_fxa(req)
     rsvp_mock.assert_called_with('*****@*****.**', False)
Exemplo n.º 2
0
 def test_rsvp_not_firefox(self, rsvp_mock, gfpe_mock, gfot_mock):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides', HTTP_USER_AGENT='Safari')
     req.COOKIES['fxaOauthState'] = 'thedude'
     gfot_mock.return_value = 'atoken'
     gfpe_mock.return_value = '*****@*****.**'
     views.oauth_fxa(req)
     rsvp_mock.assert_called_with('*****@*****.**', False)
Exemplo n.º 3
0
 def test_token_failure(self, gfot_mock):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     req.COOKIES['fxaOauthState'] = 'thedude'
     gfot_mock.return_value = None
     response = views.oauth_fxa(req)
     assert response.status_code == 302
     assert response['Location'] == '/oauth/fxa/error/'
Exemplo n.º 4
0
 def test_token_failure(self, gfot_mock):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     req.COOKIES['fxaOauthState'] = 'thedude'
     gfot_mock.return_value = None
     response = views.oauth_fxa(req)
     eq_(response.status_code, 302)
     eq_(response['Location'], '/oauth/fxa/error/')
Exemplo n.º 5
0
 def test_email_failure(self, gfpe_mock, gfot_mock):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     req.COOKIES['fxaOauthState'] = 'thedude'
     gfot_mock.return_value = 'atoken'
     gfpe_mock.return_value = None
     response = views.oauth_fxa(req)
     eq_(response.status_code, 302)
     eq_(response['Location'], '/oauth/fxa/error/')
Exemplo n.º 6
0
 def test_email_failure(self, gfpe_mock, gfot_mock):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     req.COOKIES['fxaOauthState'] = 'thedude'
     gfot_mock.return_value = 'atoken'
     gfpe_mock.return_value = None
     response = views.oauth_fxa(req)
     assert response.status_code == 302
     assert response['Location'] == '/oauth/fxa/error/'
Exemplo n.º 7
0
 def test_success(self, rsvp_mock, gfpe_mock, gfot_mock):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     req.COOKIES['fxaOauthState'] = 'thedude'
     gfot_mock.return_value = 'atoken'
     gfpe_mock.return_value = '*****@*****.**'
     response = views.oauth_fxa(req)
     assert response.cookies['fxaOauthVerified'].value == 'True'
     assert response.status_code == 302
     assert response['Location'] == '/firefox/concerts/'
Exemplo n.º 8
0
 def test_success(self, rsvp_mock, gfpe_mock, gfot_mock):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     req.COOKIES['fxaOauthState'] = 'thedude'
     gfot_mock.return_value = 'atoken'
     gfpe_mock.return_value = '*****@*****.**'
     response = views.oauth_fxa(req)
     assert response.cookies['fxaOauthVerified'].value == 'True'
     eq_(response.status_code, 302)
     eq_(response['Location'], '/firefox/concerts/')
Exemplo n.º 9
0
 def test_missing_provided_state(self):
     req = self.rf.get('/mozorg/oauth/fxa?code=abides')
     req.COOKIES['fxaOauthState'] = 'thedude'
     response = views.oauth_fxa(req)
     eq_(response.status_code, 302)
     eq_(response['Location'], '/oauth/fxa/error/')
Exemplo n.º 10
0
 def test_missing_code(self):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude')
     req.COOKIES['fxaOauthState'] = 'thedude'
     response = views.oauth_fxa(req)
     eq_(response.status_code, 302)
     eq_(response['Location'], '/oauth/fxa/error/')
Exemplo n.º 11
0
 def test_switch_off(self):
     """Should redirect to the home page if the whole system is turned off"""
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     response = views.oauth_fxa(req)
     assert response.status_code == 302
     assert response['Location'] == '/'
Exemplo n.º 12
0
 def test_missing_expected_state(self):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     response = views.oauth_fxa(req)
     eq_(response.status_code, 302)
     eq_(response['Location'], '/oauth/fxa/error/')
Exemplo n.º 13
0
 def test_state_mismatch(self):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     req.COOKIES['fxaOauthState'] = 'walter'
     response = views.oauth_fxa(req)
     eq_(response.status_code, 302)
     eq_(response['Location'], '/oauth/fxa/error/')
Exemplo n.º 14
0
 def test_switch_off(self):
     """Should redirect to the home page if the whole system is turned off"""
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     response = views.oauth_fxa(req)
     eq_(response.status_code, 302)
     eq_(response['Location'], '/')
Exemplo n.º 15
0
 def test_missing_expected_state(self):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     response = views.oauth_fxa(req)
     assert response.status_code == 302
     assert response['Location'] == '/oauth/fxa/error/'
Exemplo n.º 16
0
 def test_missing_provided_state(self):
     req = self.rf.get('/mozorg/oauth/fxa?code=abides')
     req.COOKIES['fxaOauthState'] = 'thedude'
     response = views.oauth_fxa(req)
     assert response.status_code == 302
     assert response['Location'] == '/oauth/fxa/error/'
Exemplo n.º 17
0
 def test_state_mismatch(self):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude&code=abides')
     req.COOKIES['fxaOauthState'] = 'walter'
     response = views.oauth_fxa(req)
     assert response.status_code == 302
     assert response['Location'] == '/oauth/fxa/error/'
Exemplo n.º 18
0
 def test_missing_code(self):
     req = self.rf.get('/mozorg/oauth/fxa?state=thedude')
     req.COOKIES['fxaOauthState'] = 'thedude'
     response = views.oauth_fxa(req)
     assert response.status_code == 302
     assert response['Location'] == '/oauth/fxa/error/'