67 def test_vregistry_path(self): |
69 def test_vregistry_path(self): |
68 self.assertEquals([unabsolutize(p) for p in self.config.vregistry_path()], |
70 self.assertEquals([unabsolutize(p) for p in self.config.vregistry_path()], |
69 ['entities', 'web/views', 'sobjects', |
71 ['entities', 'web/views', 'sobjects', |
70 'file/entities.py', 'file/views', 'file/hooks.py', |
72 'file/entities.py', 'file/views', 'file/hooks.py', |
71 'email/entities.py', 'email/views', 'email/hooks.py']) |
73 'email/entities.py', 'email/views', 'email/hooks.py']) |
72 |
74 |
|
75 def test_cubes_path(self): |
|
76 os.environ['CW_CUBES_PATH'] = join(dirname(__file__), 'data', 'cubes') |
|
77 self.assertEquals(self.config.cubes_search_path(), |
|
78 [abspath(join(dirname(__file__), 'data', 'cubes')), |
|
79 self.config.CUBES_DIR]) |
|
80 os.environ['CW_CUBES_PATH'] = '%s%s%s%s%s' % (join(dirname(__file__), 'data', 'cubes'), |
|
81 os.pathsep, self.config.CUBES_DIR, |
|
82 os.pathsep, 'unexistant') |
|
83 # filter out unexistant and duplicates |
|
84 self.assertEquals(self.config.cubes_search_path(), |
|
85 [abspath(join(dirname(__file__), 'data', 'cubes')), |
|
86 self.config.CUBES_DIR]) |
|
87 self.failUnless('mycube' in self.config.available_cubes()) |
|
88 # test cubes python path |
|
89 self.config.adjust_sys_path() |
|
90 import cubes |
|
91 self.assertEquals(cubes.__path__, self.config.cubes_search_path()) |
|
92 # this import should succeed once path is adjusted |
|
93 from cubes import mycube |
|
94 self.assertEquals(mycube.__path__, [abspath(join(dirname(__file__), 'data', 'cubes', 'mycube'))]) |
|
95 # file cube should be overriden by the one found in data/cubes |
|
96 sys.modules.pop('cubes.file', None) |
|
97 del cubes.file |
|
98 from cubes import file |
|
99 self.assertEquals(file.__path__, [abspath(join(dirname(__file__), 'data', 'cubes', 'file'))]) |
|
100 |
|
101 |
73 if __name__ == '__main__': |
102 if __name__ == '__main__': |
74 unittest_main() |
103 unittest_main() |