Skip to content

Commit

Permalink
Test can add non-existent tag with correct permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
mfonism committed May 24, 2020
1 parent 5b255ed commit 0932738
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tcms/bugs/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from tcms.bugs.models import Bug
from tcms.bugs.tests.factory import BugFactory
from tcms.management.models import Tag
from tcms.rpc.tests.utils import APITestCase
from tcms.tests.factories import TagFactory

Expand All @@ -24,6 +25,11 @@ def test_add_tag(self):
self.rpc_client.Bug.add_tag(self.bug.pk, self.tag.name)
self.assertIn(self.tag, Bug.objects.get(pk=self.bug.pk).tags.all())

def test_add_non_existent_tag(self):
self.assertNotIn('fedora', Tag.objects.values_list('name', flat=True))
self.rpc_client.Bug.add_tag(self.bug.pk, 'fedora')
self.assertIn('fedora', Tag.objects.values_list('name', flat=True))

def test_add_tag_to_non_existent_bug(self):
with self.assertRaisesRegex(XmlRPCFault, 'Bug matching query does not exist'):
self.rpc_client.Bug.add_tag(-99, self.tag.name)
Expand Down

0 comments on commit 0932738

Please sign in to comment.