Пример #1
0
 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)
Пример #2
0
    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)
Пример #3
0
 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)
Пример #4
0
    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)
Пример #5
0
 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)
Пример #6
0
 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)
Пример #7
0
    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)
Пример #8
0
    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)
Пример #9
0
 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)