Пример #1
0
    def test_files_from_tar_error(self):
        mock_stream = MagicMock(spec=BytesIO)
        mock_stream.isatty.return_value = False
        mock_stream.read.side_effect = Exception("kaboom")
        tar_contents = files_from_tar(mock_stream)

        self.assertEquals(tar_contents, {})
Пример #2
0
    def test_files_from_tar_error(self):
        mock_stream = MagicMock(spec=BytesIO)
        mock_stream.isatty.return_value = False
        mock_stream.read.side_effect = Exception('kaboom')
        tar_contents = files_from_tar(mock_stream)

        self.assertEquals(tar_contents, {})
Пример #3
0
    def test_files_from_tar_tty(self):
        mock_stream = MagicMock(spec=BytesIO)
        mock_stream.isatty.return_value = True
        tar_contents = files_from_tar(mock_stream)

        self.assertEquals(tar_contents, {})
Пример #4
0
    def test_files_from_tar(self):
        tar_buf = self.generate_tar({'test.txt': 'test'})

        tar_contents = files_from_tar(tar_buf)
        self.assertEquals(len(tar_contents), 1)
        self.assertEquals(tar_contents['test.txt'], 'test')
Пример #5
0
    def test_files_from_tar_tty(self):
        mock_stream = MagicMock(spec=BytesIO)
        mock_stream.isatty.return_value = True
        tar_contents = files_from_tar(mock_stream)

        self.assertEquals(tar_contents, {})
Пример #6
0
    def test_files_from_tar(self):
        tar_buf = self.generate_tar({"test.txt": "test"})

        tar_contents = files_from_tar(tar_buf)
        self.assertEquals(len(tar_contents), 1)
        self.assertEquals(tar_contents["test.txt"], "test")
Пример #7
0
    def test_files_from_tar(self):
        tar_buf = self.generate_tar({'test.txt': 'test'})

        tar_contents = files_from_tar(tar_buf)
        self.assertEquals(len(tar_contents), 1)
        self.assertEquals(tar_contents['test.txt'], 'test')