Commit 5e4aaacf authored by Okhin's avatar Okhin

We need an actual dict without None as parameters for forms

parent 32ce8428
Pipeline #2640 failed with stages
in 40 seconds
...@@ -202,11 +202,13 @@ class TestArticleViews(TestCase): ...@@ -202,11 +202,13 @@ class TestArticleViews(TestCase):
self.client.force_login(user=self.user) self.client.force_login(user=self.user)
pk = self.articles[0].pk pk = self.articles[0].pk
fields = {'title': 'Zog Zog'} a = {'title': 'Zog Zog',
'status': 'NEW',
r = self.client.post('/rp/article/edit/{}/'.format(pk), fields) 'lang': 'FR',
'url': 'https://www.example.org/'}
r = self.client.post('/rp/article/edit/{}/'.format(pk), a)
a = Article.objects.get(pk=pk) a = Article.objects.get(pk=pk)
assert r.status_code == 302 # We're redirecting after edit assert r.status_code == 302 # We're redirecting to the view or preview of the article
assert a.title == 'Zog Zog' assert a.title == 'Zog Zog'
...@@ -347,7 +349,7 @@ class TestArticleApi(TestCase): ...@@ -347,7 +349,7 @@ class TestArticleApi(TestCase):
# We cannot recover a published article # We cannot recover a published article
a = ArticleFactory(status='PUBLISHED') a = ArticleFactory(status='PUBLISHED')
r = self.client.post('/api/articles/{}/recover/'.format(a.id)) r = self.client.post('/api/articles/{}/recover/'.format(a.id))
assert r.status_code == 403 assert r.status_code == 400
def test_api_set_priority(self): def test_api_set_priority(self):
self.user.user_permissions.add(Permission.objects.get( self.user.user_permissions.add(Permission.objects.get(
...@@ -355,7 +357,7 @@ class TestArticleApi(TestCase): ...@@ -355,7 +357,7 @@ class TestArticleApi(TestCase):
self.client.force_login(user=self.user) self.client.force_login(user=self.user)
a = ArticleFactory(status='DRAFT') a = ArticleFactory(status='DRAFT')
assert a.priority is False assert a.priority is False
r = self.client.post('/api/articles/{}/set_priority/'.format(a.id)) r = self.client.post('/api/articles/{}/set-priority/'.format(a.id))
assert r.status_code == 200 assert r.status_code == 200
assert r.data['priority'] assert r.data['priority']
...@@ -365,6 +367,6 @@ class TestArticleApi(TestCase): ...@@ -365,6 +367,6 @@ class TestArticleApi(TestCase):
self.client.force_login(user=self.user) self.client.force_login(user=self.user)
a = ArticleFactory(status='DRAFT', priority=True) a = ArticleFactory(status='DRAFT', priority=True)
assert a.priority assert a.priority
r = self.client.post('/api/articles/{}/unset_priority/'.format(a.id)) r = self.client.post('/api/articles/{}/unset-priority/'.format(a.id))
assert r.status_code == 200 assert r.status_code == 200
assert r.data['priority'] is False assert r.data['priority'] is False
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