]>
Commit | Line | Data |
---|---|---|
f9a38dd2 MT |
1 | #!/usr/bin/python3 |
2 | ||
3 | import unittest | |
4 | ||
5 | import test | |
6 | ||
7 | from buildservice import distribution | |
8 | ||
9 | class 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 | ||
35 | if __name__ == "__main__": | |
36 | unittest.main() |