]> git.ipfire.org Git - pbs.git/commitdiff
tests: Check whether we can add a watcher to a build
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Oct 2022 17:54:38 +0000 (17:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Oct 2022 17:54:38 +0000 (17:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/build.py

index 4c1c0b58961c350289b502e629569dc3c8a83f06..8571622023a6636fe8583f043ce3ed128c9ffdd9 100755 (executable)
@@ -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()