Total Complexity | 4 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 9 | ||
Bugs | 0 | Features | 0 |
1 | # -*- coding: utf-8 -*- |
||
10 | class TestArgParserTests(unittest.TestCase): |
||
11 | def setUp(self): |
||
12 | self.zip_structure = [ |
||
13 | '1', |
||
14 | '2', |
||
15 | '3', |
||
16 | 'a/1', |
||
17 | 'a/2', |
||
18 | 'a/3', |
||
19 | 'b/1', |
||
20 | 'b/2', |
||
21 | 'b/3' |
||
22 | ] |
||
23 | |||
24 | self.test_dir = tempfile.mkdtemp() |
||
25 | |||
26 | def tearDown(self): |
||
27 | shutil.rmtree(self.test_dir) |
||
28 | |||
29 | @patch('os.walk') |
||
30 | def test_directoryzip_integration(self, os_walk): |
||
31 | os_walk.return_value = ((self.test_dir, (), self.zip_structure),) |
||
32 | |||
33 | mock_write = MagicMock() |
||
34 | zipdirectory = DirectoryZipFile(self.test_dir) |
||
35 | zipdirectory.write = mock_write |
||
36 | zipdirectory.create_archive() |
||
37 | zipdirectory.close() |
||
38 | |||
39 | |||
40 | calls = map(lambda file: call(os.path.join(self.test_dir, file), file), self.zip_structure) |
||
41 | mock_write.assert_has_calls(calls) |
||
42 |