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