# Path: brasilcomvc/portal/views.py
# def blog_redirect(request):
#     """Simple redirect to blog URL.
#     """
#     if not settings.BLOG_URL:
#         raise Http404()
#     return HttpResponsePermanentRedirect(settings.BLOG_URL)


from django.core.urlresolvers import reverse
from django.http import Http404
from django.test import RequestFactory, TestCase
from ..views import blog_redirect



class BlogRedirectTestCase(TestCase):

    def test_blog_redirect_with_empty_setting(self):
        req = RequestFactory().get('/blog')
        with self.assertRaises(Http404):
            with self.settings(BLOG_URL=''):
                resp = blog_redirect(req)

    def test_blog_redirect_with_valid_setting(self):
        req = RequestFactory().get('/blog')
        with self.settings(BLOG_URL='http://blog'):

# Path: brasilcomvc/portal/views.py
# def blog_redirect(request):
#     """Simple redirect to blog URL.
#     """
#     if not settings.BLOG_URL:
#         raise Http404()
#     return HttpResponsePermanentRedirect(settings.BLOG_URL)


# Path: brasilcomvc/portal/tests/test_views.py
from django.core.urlresolvers import reverse
from django.http import Http404
from django.test import RequestFactory, TestCase
from ..views import blog_redirect




class BlogRedirectTestCase(TestCase):

    def test_blog_redirect_with_empty_setting(self):
        req = RequestFactory().get('/blog')
        with self.assertRaises(Http404):
            with self.settings(BLOG_URL=''):
                resp = blog_redirect(req)

    def test_blog_redirect_with_valid_setting(self):
        req = RequestFactory().get('/blog')
        with self.settings(BLOG_URL='http://blog'):

            resp = blog_redirect(req)