From: Michael Tremer Date: Wed, 12 Oct 2022 14:41:12 +0000 (+0000) Subject: tests: Add some basic repo tests X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ac581c0f665755b99f614b4527ca3a691c33b59;p=pbs.git tests: Add some basic repo tests Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index ef46339b..1bba8dad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -486,7 +486,8 @@ TESTS_ENVIRONMENT = \ dist_check_SCRIPTS = \ tests/setup.py \ - tests/distro.py + tests/distro.py \ + tests/repo.py EXTRA_DIST += \ tests/test.py diff --git a/tests/repo.py b/tests/repo.py new file mode 100755 index 00000000..5dfa24b1 --- /dev/null +++ b/tests/repo.py @@ -0,0 +1,33 @@ +#!/usr/bin/python3 + +import unittest + +import test + +from buildservice import keys +from buildservice import repository + +class RepoTestCase(test.TestCase): + """ + Tests everything around the Repo object + """ + async def test_create(self): + """ + Tests whether we can create a repository + """ + with self.db.transaction(): + repo = await self.backend.repos.create(self.distro, "Random Test Repository") + + # Check that we got the correct type back + self.assertIsInstance(repo, repository.Repository) + + # Check if the values got set correct + self.assertEqual(repo.name, "Random Test Repository") + #self.assertEqual(repo.slug, "random-test-repository") + + # Check if a key was generated + self.assertIsInstance(repo.key, keys.Key) + + +if __name__ == "__main__": + unittest.main()