Commit cef50904 authored by okhin's avatar okhin 🚴

Merge branch '24-redirection-loop' into 'rp2'

Resolve "Redirection loop"

Closes #24

See merge request !44
parents 1b84d06e 776cf64d
Pipeline #2619 passed with stages
in 3 minutes and 8 seconds
......@@ -122,7 +122,9 @@ class TestArticleViews(TestCase):
def test_search_view(self):
article = ArticleFactory(title=u'Zog Zog chez les schtroumphs',
lang='FR')
lang='FR',
archive=False,
status='PUBLISHED')
article.save()
r = self.client.get('/rp/', {'q': 'Zog Zog'})
......@@ -131,7 +133,9 @@ class TestArticleViews(TestCase):
assert len(r.context['article_list']) == 0
def test_search_view_archived(self):
archive = ArticleFactory(archive=True, lang='FR')
archive = ArticleFactory(archive=True,
lang='FR',
status='PUBLISHED')
r = self.client.get('/rp/', {'q': '', 'archive': 'true'})
assert len(r.context['article_list']) == 1
......@@ -141,7 +145,10 @@ class TestArticleViews(TestCase):
assert len(r.context['article_list']) == 0
def test_search_view_speaks(self):
speak = ArticleFactory(speak=True, lang='FR')
speak = ArticleFactory(speak=True,
archive=False,
lang='FR',
status='PUBLISHED')
r = self.client.get('/rp/', {'q': '', 'speak': 'true'})
assert len(r.context['article_list']) == 1
......@@ -151,7 +158,10 @@ class TestArticleViews(TestCase):
assert len(r.context['article_list']) == 0
def test_search_view_quoted(self):
quote = ArticleFactory(quote=True, lang='FR')
quote = ArticleFactory(quote=True,
archive=False,
lang='FR',
status='PUBLISHED')
r = self.client.get('/rp/', {'q': '', 'quote': 'true'})
assert len(r.context['article_list']) == 1
......
......@@ -138,9 +138,10 @@ class ArticleDetailView(LoginRequiredMixin, DetailView):
return context
class ArticleEdit(PermissionRequiredMixin, UpdateView):
class ArticleEdit(LoginRequiredMixin, PermissionRequiredMixin, UpdateView):
model = Article
permission_required = 'rp.can_edit'
raise_exception = True
fields = ['screenshot', 'url', 'lang', 'title', 'tags', 'extracts',
'quote', 'speak', 'archive']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment