File: test_watchers.py

package info (click to toggle)
python-jira 3.10.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,024 kB
  • sloc: python: 8,877; sh: 13; makefile: 7; xml: 4
file content (23 lines) | stat: -rw-r--r-- 948 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

from tests.conftest import JiraTestCase


class WatchersTests(JiraTestCase):
    def setUp(self):
        JiraTestCase.setUp(self)
        self.issue_1 = self.test_manager.project_b_issue1

    def test_add_remove_watcher(self):
        # removing it in case it exists, so we know its state
        self.jira.remove_watcher(self.issue_1, self.test_manager.user_normal.name)
        init_watchers = self.jira.watchers(self.issue_1).watchCount

        # adding a new watcher
        self.jira.add_watcher(self.issue_1, self.test_manager.user_normal.name)
        self.assertEqual(self.jira.watchers(self.issue_1).watchCount, init_watchers + 1)

        # now we verify that remove does indeed remove watchers
        self.jira.remove_watcher(self.issue_1, self.test_manager.user_normal.name)
        new_watchers = self.jira.watchers(self.issue_1).watchCount
        self.assertEqual(init_watchers, new_watchers)