コード例 #1
0
ファイル: test_views.py プロジェクト: alexgibson/bedrock
 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)
コード例 #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)
コード例 #3
0
ファイル: test_views.py プロジェクト: alexgibson/bedrock
 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/'
コード例 #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/')
コード例 #5
0
ファイル: test_views.py プロジェクト: fmarier/bedrock
 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/')
コード例 #6
0
ファイル: test_views.py プロジェクト: vaibhawW/bedrock
 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/'
コード例 #7
0
ファイル: test_views.py プロジェクト: alexgibson/bedrock
 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/'
コード例 #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/')
コード例 #9
0
ファイル: test_views.py プロジェクト: fmarier/bedrock
 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/')
コード例 #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/')
コード例 #11
0
ファイル: test_views.py プロジェクト: alexgibson/bedrock
 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'] == '/'
コード例 #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/')
コード例 #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/')
コード例 #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'], '/')
コード例 #15
0
ファイル: test_views.py プロジェクト: alexgibson/bedrock
 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/'
コード例 #16
0
ファイル: test_views.py プロジェクト: vaibhawW/bedrock
 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/'
コード例 #17
0
ファイル: test_views.py プロジェクト: alexgibson/bedrock
 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/'
コード例 #18
0
ファイル: test_views.py プロジェクト: alexgibson/bedrock
 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/'