Esempio n. 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, {})
Esempio n. 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, {})
Esempio n. 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, {})
Esempio n. 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')
Esempio n. 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, {})
Esempio n. 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")
Esempio n. 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')