Exemplo n.º 1
0
    def test_view_loginhash_no_valid_url(self):
        self.valid_site.delete()
        def mocked_render(context, **response_kwargs):

            assert_equals(context['domains_whitelist'], [])

            return HttpResponse()

        view = LoginHashView()
        view.render_to_response = mocked_render
        view.get(self.request)
Exemplo n.º 2
0
    def test_view_loginhash(self):
        self.invalid_site = EntreeSite.objects.create(title='xfoo', is_active=False, secret='neco', url="http://vanyli.net")

        def mocked_render(context, **response_kwargs):
            assert_equals(context['domains_whitelist'], [urlparse(self.valid_site.url).hostname])
            assert_equals(context['entree'], ENTREE_SAFE)
            return HttpResponse()

        view = LoginHashView()
        view.render_to_response = mocked_render
        view.get(self.request)
Exemplo n.º 3
0
    def test_view_loginhash_no_valid_url(self):
        self.valid_site.delete()

        def mocked_render(context, **response_kwargs):

            assert_equals(context['domains_whitelist'], [])

            return HttpResponse()

        view = LoginHashView()
        view.render_to_response = mocked_render
        view.get(self.request)
Exemplo n.º 4
0
    def test_view_loginhash(self):
        self.invalid_site = EntreeSite.objects.create(title='xfoo',
                                                      is_active=False,
                                                      secret='neco',
                                                      url="http://vanyli.net")

        def mocked_render(context, **response_kwargs):
            assert_equals(context['domains_whitelist'],
                          [urlparse(self.valid_site.url).hostname])
            assert_equals(context['entree'], ENTREE_SAFE)
            return HttpResponse()

        view = LoginHashView()
        view.render_to_response = mocked_render
        view.get(self.request)