def test_flat_tab_view_requires_ssl(self): from mocks import MockedFacebookTabView tab = FACTORY.create_flat_tab() view = MockedFacebookTabView.as_view(object=tab) request = self.factory.post('/fbapps/flat-tab/someslug/') response = view(request) self.assertContains(response, 'SSL Only', status_code=400)
def test_flat_tab_view_requires_ssl(self): from mocks import MockedFacebookTabView tab = FACTORY.create_flat_tab() view = MockedFacebookTabView.as_view(object=tab) request = self.factory.post("/fbapps/flat-tab/someslug/") response = view(request) self.assertContains(response, "SSL Only", status_code=400)
def test_generic_tab_view(self): from mocks import MockedFacebookTabView tab = FACTORY.create_generic_content_tab() view = MockedFacebookTabView.as_view(object=tab, _facebook_data={}) request = self.factory.post('/fbapps/generic-tab/1/', {'signed_request':'ABC'}, **{'wsgi.url_scheme':'https'}) request.user = AnonymousUser() response = view(request) self.assertEqual(response.status_code, 200)
def test_flat_tab_view_requires_signed_request(self): from mocks import MockedFacebookTabView tab = FACTORY.create_flat_tab() view = MockedFacebookTabView.as_view(object=tab, _facebook_data={}) request = self.factory.post("/fbapps/flat-tab/someslug/", **{"wsgi.url_scheme": "https"}) request.user = AnonymousUser() response = view(request) self.assertContains(response, "Missing Signed Request", status_code=400)
def test_flat_tab_view(self): from mocks import MockedFacebookTabView tab = FACTORY.create_flat_tab() view = MockedFacebookTabView.as_view(object=tab, _facebook_data={}) request = self.factory.post('/fbapps/flat-tab/someslug/', {'signed_request': 'ABC'}, **{'wsgi.url_scheme': 'https'}) request.user = AnonymousUser() response = view(request) self.assertEqual(response.status_code, 200)
def test_flat_tab_view_requires_signed_request(self): from mocks import MockedFacebookTabView tab = FACTORY.create_flat_tab() view = MockedFacebookTabView.as_view(object=tab, _facebook_data={}) request = self.factory.post('/fbapps/flat-tab/someslug/', **{'wsgi.url_scheme': 'https'}) request.user = AnonymousUser() response = view(request) self.assertContains(response, 'Missing Signed Request', status_code=400)
def test_flat_tab_view_by_staff_user(self): from mocks import MockedFacebookTabView tab = FACTORY.create_flat_tab() user = User.objects.create_user("username", "*****@*****.**", "password") user.is_staff = True view = MockedFacebookTabView.as_view(object=tab) request = self.factory.get("/fbapps/flat-tab/someslug/", **{"wsgi.url_scheme": "https"}) request.user = user response = view(request) self.assertEqual(response.status_code, 200)
def test_flat_tab_view(self): from mocks import MockedFacebookTabView tab = FACTORY.create_flat_tab() view = MockedFacebookTabView.as_view(object=tab, _facebook_data={}) request = self.factory.post( "/fbapps/flat-tab/someslug/", {"signed_request": "ABC"}, **{"wsgi.url_scheme": "https"} ) request.user = AnonymousUser() response = view(request) self.assertEqual(response.status_code, 200)
def test_flat_tab_view_by_staff_user(self): from mocks import MockedFacebookTabView tab = FACTORY.create_flat_tab() user = User.objects.create_user('username', '*****@*****.**', 'password') user.is_staff = True view = MockedFacebookTabView.as_view(object=tab) request = self.factory.get('/fbapps/flat-tab/someslug/', **{'wsgi.url_scheme': 'https'}) request.user = user response = view(request) self.assertEqual(response.status_code, 200)