Commit 838c9d53 authored by Okhin's avatar Okhin

Adding a new test for checking set_flags method()

parent f88274d7
Pipeline #2673 passed with stages
in 3 minutes and 45 seconds
......@@ -182,6 +182,33 @@ class TestArticleViews(TestCase):
assert a.title == 'Zog Zog'
assert set(a.tags.names()) == set(self.articles[0].tags.names()) | {"merged tag"}
def test_article_edit_with_tags_as_empty_list(self):
self.user.user_permissions.add(Permission.objects.get(
codename='can_edit'))
self.client.force_login(user=self.user)
pk = self.articles[0].pk
a = {'tags': [""]}
r = self.client.post('/rp/article/edit/{}/'.format(pk), a)
a = Article.objects.get(pk=pk)
assert r.status_code == 200
assert set(a.tags.names()) == set()
def test_article_edit_with_tags_as_empty_string(self):
self.user.user_permissions.add(Permission.objects.get(
codename='can_edit'))
self.client.force_login(user=self.user)
pk = self.articles[0].pk
tags = self.articles[0].tags
a = {'tags': [""]}
r = self.client.post('/rp/article/edit/{}/'.format(pk), a)
a = Article.objects.get(pk=pk)
assert r.status_code == 200
assert set(a.tags.names()) == set(tags.names())
class TestArticleApi(TestCase):
def setUp(self):
......
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