From: Michael Tremer Date: Wed, 12 Oct 2022 17:19:08 +0000 (+0000) Subject: tests: Add tests for builders X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=890486ab1e73b8ae41fe2cf57e0dced2222c4d32;p=pbs.git tests: Add tests for builders Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 724c69d2..58b22183 100644 --- a/Makefile.am +++ b/Makefile.am @@ -486,6 +486,7 @@ TESTS_ENVIRONMENT = \ dist_check_SCRIPTS = \ tests/setup.py \ + tests/builder.py \ tests/distro.py \ tests/package.py \ tests/repo.py \ diff --git a/tests/builder.py b/tests/builder.py new file mode 100755 index 00000000..7d360026 --- /dev/null +++ b/tests/builder.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 + +import unittest + +import test + +from buildservice import builders + +class BuilderTestCase(test.TestCase): + """ + Tests everything around builders + """ + async def test_create(self): + """ + Tests whether we can create a repository + """ + with self.db.transaction(): + builder = self.backend.builders.create("test-builder02.ipfire.org") + + # Check that we got the correct type back + self.assertIsInstance(builder, builders.Builder) + + def test_default(self): + """ + Tests whether we can access the default builder + """ + self.assertIsInstance(self.builder, builders.Builder) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test.py b/tests/test.py index 612ca169..b7109760 100644 --- a/tests/test.py +++ b/tests/test.py @@ -110,6 +110,9 @@ class TestCase(unittest.IsolatedAsyncioTestCase): Creates some random objects that are created by default so that we won't have to start from scratch each time... """ + # Create a builder + self.builder = self.backend.builders.create("test-builder01.ipfire.org") + # Create a user self.user = self.backend.users.create("tester", "Joe Tester")