]> git.ipfire.org Git - pbs.git/blame - tests/distro.py
web: Drop the POST-based stats handler
[pbs.git] / tests / distro.py
CommitLineData
f9a38dd2
MT
1#!/usr/bin/python3
2
3import unittest
4
5import test
6
7from buildservice import distribution
8
9class DistroTestCase(test.TestCase):
10 """
11 Tests everything around the Distro object
12 """
13 def test_create(self):
14 """
15 Tests whether we can create a distribution
16 """
17 with self.db.transaction():
19b92c2e 18 distro = self.backend.distros.create("Random Test Distribution 2", "test", 2)
f9a38dd2
MT
19
20 # Check that we got the correct type back
21 self.assertIsInstance(distro, distribution.Distribution)
22
23 # Check if the values got set correct
19b92c2e
MT
24 self.assertEqual(distro.name, "Random Test Distribution 2")
25 self.assertEqual(distro.slug, "test-2")
26 self.assertEqual(distro.tag, "test2")
f9a38dd2
MT
27
28 def test_default(self):
29 """
30 Tests whether we can access the default distribution
31 """
32 self.assertIsInstance(self.distro, distribution.Distribution)
33
34
35if __name__ == "__main__":
36 unittest.main()