--- /dev/null
+#!/usr/bin/python3
+
+import unittest
+
+import test
+
+from buildservice import distribution
+
+class DistroTestCase(test.TestCase):
+ """
+ Tests everything around the Distro object
+ """
+ def test_create(self):
+ """
+ Tests whether we can create a distribution
+ """
+ with self.db.transaction():
+ distro = self.backend.distros.create("Random Test Distribution 1", "test1")
+
+ # Check that we got the correct type back
+ self.assertIsInstance(distro, distribution.Distribution)
+
+ # Check if the values got set correct
+ self.assertEqual(distro.name, "Random Test Distribution 1")
+ self.assertEqual(distro.tag, "test1")
+
+ def test_default(self):
+ """
+ Tests whether we can access the default distribution
+ """
+ self.assertIsInstance(self.distro, distribution.Distribution)
+
+
+if __name__ == "__main__":
+ unittest.main()
#!/usr/bin/python3
import configparser
+import functools
import os
import socket
import tempfile
# Initialize the backend
self.backend = Backend(f.name)
+
+ # Create handle to the database
+ self.db = self.backend.db
+
+ # Some random objects that are created on-demand so that we won't have to
+ # start from scratch each time...
+
+ @functools.cached_property
+ def distro(self):
+ """
+ Creates a distribution
+ """
+ return self.backend.distros.create("Test Distribution 1", "test1")