Commit acd7adfd authored by okhin's avatar okhin 🚴

Testing updating the article

parent a0d3c790
Pipeline #2631 passed with stages
in 3 minutes and 15 seconds
......@@ -179,6 +179,24 @@ class TestArticleViews(TestCase):
r = self.client.get('/rp/article/view/{}'.format(a.pk))
assert r.context['object'] == a
def test_article_edit_unauth(self):
a = self.articles[0]
r = self.client.post('/rp/article/edit/{}'.format(a.pk))
assert r.status_code == 403
def test_article_edit(self):
self.user.user_permissions.add(Permission.objects.get(
codename='can_edit'))
self.client.force_login(user=self.user)
a = self.articles[0]
a.title = 'Zog Zog'
a.screenshot = '/tmp/{}.png'.format(a.pk)
r = self.client.post('/rp/article/edit/{}'.format(a.pk),
a.__dict__)
a.refresh_from_db()
assert r.status_code == 302
assert a.title == 'Zog Zog'
class TestArticleApi(TestCase):
def setUp(self):
......@@ -267,7 +285,7 @@ class TestArticleApi(TestCase):
r = self.client.post('/api/articles/{}/recover/'.format(a.id))
assert r.status_code == 403
# Can we recovr a NEW article and force it to DRAFT?
# Can we recover a NEW article and force it to DRAFT?
self.user.user_permissions.add(Permission.objects.get(
codename='can_change_status'))
self.client.force_login(user=self.user)
......
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