Total Complexity | 9 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 1 | Features | 2 |
1 | #!/usr/bin/env python |
||
18 | class TestRealHooksAcceptance(AbstractAcceptanceTest): |
||
19 | |||
20 | def _repo_id(self): |
||
21 | return 'test-real-hooks-acceptance' |
||
22 | |||
23 | def assert_real_hook_is_run_in_place(self, template): |
||
24 | """ |
||
25 | assert that the real hook is run in place |
||
26 | :param template: template id |
||
27 | """ |
||
28 | template_dir = os.path.join(self.templates_path, template) |
||
29 | file = os.path.join(self.project_dir, template) |
||
30 | self.run(template) |
||
31 | assert os.path.exists(file) |
||
32 | content = read_file(file) |
||
33 | assert template_dir == content.strip() |
||
34 | |||
35 | def test_renderable_hooks_can_be_run(self): |
||
36 | """ |
||
37 | regression test |
||
38 | """ |
||
39 | template = 'renderable' |
||
40 | self.run(template) |
||
41 | assert os.path.exists(os.path.join(self.project_dir, template)) |
||
42 | |||
43 | def test_run_real_hook_in_place(self): |
||
44 | """ |
||
45 | run a real hook in place: python file |
||
46 | """ |
||
47 | self.assert_real_hook_is_run_in_place('inplace') |
||
48 | |||
49 | def test_run_real_hook_in_place_shell(self): |
||
50 | """ |
||
51 | run a real hook in place: bash or batch file depending on the OS |
||
52 | """ |
||
53 | template = 'batch' if sys.platform.startswith('win') else 'bash' |
||
54 | self.assert_real_hook_is_run_in_place(template) |
||
55 |