]> git.ipfire.org Git - pbs.git/commitdiff
tests: Add some tests for builds
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Oct 2022 17:31:22 +0000 (17:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Oct 2022 17:31:22 +0000 (17:31 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
tests/build.py [new file with mode: 0755]

index 58b221833ca2651bb82b15949cbad5de960cb5f2..94db0b10cfd7313294eea2e68b74257940355c4f 100644 (file)
@@ -486,6 +486,7 @@ TESTS_ENVIRONMENT = \
 
 dist_check_SCRIPTS = \
        tests/setup.py \
+       tests/build.py \
        tests/builder.py \
        tests/distro.py \
        tests/package.py \
diff --git a/tests/build.py b/tests/build.py
new file mode 100755 (executable)
index 0000000..9661089
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+
+import unittest
+
+import test
+
+class BuildTestCase(test.TestCase):
+       """
+               Tests everything around builds
+       """
+       async def test_create_from_binary(self):
+               """
+                       Tests whether we can create a build from a binary package
+               """
+               path = self.source_path("tests/data/beep-1.3-2.ip3.x86_64.pfm")
+
+               with self.db.transaction():
+                       package = await self._create_package(path)
+
+                       # Create the build
+                       with self.assertRaises(RuntimeError):
+                               build = self.backend.builds.create(self.repo, package, owner=self.user)
+
+
+if __name__ == "__main__":
+       unittest.main()