GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 73c5c0...bade8b )
by Drew J.
43s
created

TestArgParserTests   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 9
Bugs 0 Features 0
Metric Value
c 9
b 0
f 0
dl 0
loc 32
rs 10
wmc 4
1
# -*- coding: utf-8 -*-
2
import os
3
import shutil
4
import tempfile
5
import unittest
6
from mock import patch, MagicMock, call
7
from awslambdahelper.cli import DirectoryZipFile
8
9
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