From: Michael Tremer Date: Wed, 12 Oct 2022 17:54:38 +0000 (+0000) Subject: tests: Check whether we can add a watcher to a build X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=108fe9af81c963c8f82664ff1416dfdb7d100aac;p=pbs.git tests: Check whether we can add a watcher to a build Signed-off-by: Michael Tremer --- diff --git a/tests/build.py b/tests/build.py index 4c1c0b58..85716220 100755 --- a/tests/build.py +++ b/tests/build.py @@ -39,6 +39,23 @@ class BuildTestCase(test.TestCase): with self.assertRaises(RuntimeError): build = self.backend.builds.create(self.repo, package, owner=self.user) + async def test_watchers(self): + """ + Tests whether we can add a watcher to a build + """ + path = self.source_path("tests/data/beep-1.3-2.ip3.src.pfm") + + # Create the build + with self.db.transaction(): + build = await self._create_build(path) + + # Add the default user as watcher + with self.db.transaction(): + build.add_watcher(self.user) + + # Check if the watcher has been added + self.assertIn(self.user, build.get_watchers()) + if __name__ == "__main__": unittest.main()