root/branches/mk/tests/unit/test_index_unpack_dir.py

Revision 93, 1.4 kB (checked in by mk, 6 years ago)

Use raw index class name as index name.

Line 
1 import os
2
3 import _path_cheesecake
4 from _helper_cheesecake import DATA_PATH
5 from cheesecake.cheesecake_index import Cheesecake, IndexUnpackDir
6
7
8 class IndexUnpackDirTest(object):
9     def setUp(self):
10         self.cheesecake = None
11
12     def tearDown(self):
13         if not self.cheesecake:
14             return
15         self.cheesecake.cleanup()
16
17 class TestIndexUnpackDirCorrectPackage(IndexUnpackDirTest):
18     def test_index_unpack_dir_correct_package(self):
19         self.cheesecake = Cheesecake(path=os.path.join(DATA_PATH, "package1.tar.gz"))
20         index = self.cheesecake.index["INSTALLABILITY"]["IndexUnpackDir"]
21
22         index.compute_with(self.cheesecake)
23
24         assert index.name == "IndexUnpackDir"
25         assert index.value == IndexUnpackDir.max_value
26         assert index.details == "unpack directory is " + self.cheesecake.package_name + " as expected"
27
28 class TestIndexUnpackDirCorrectPackage(IndexUnpackDirTest):
29     def test_index_unpack_dir_incorrect_package(self):
30         self.cheesecake = Cheesecake(path=os.path.join(DATA_PATH, "package_renamed.tar.gz"))
31         index = self.cheesecake.index["INSTALLABILITY"]["IndexUnpackDir"]
32
33         index.compute_with(self.cheesecake)
34
35         assert index.name == "IndexUnpackDir"
36         print index.value, index.max_value
37         assert index.value == 0
38         assert index.details == "unpack directory is package1 instead of the expected package_renamed"
Note: See TracBrowser for help on using the browser.