def test_unbundle_calls_mkpath_with_correct_arguments(self):
     mock_tar = self.MockFileContextManager()
     self.mock_tarfile_open.return_value = mock_tar
     job_source_bundle = JobSourceBundle(self.fake_bundle_name,
                                         self.fake_target_name)
     job_source_bundle.unbundle('../')
     self.mock_mkpath.assert_called_with('../')
 def test_unbundle_extracts_from_tarfile(self):
     mock_tar = self.MockFileContextManager()
     self.mock_tarfile_open.return_value = mock_tar
     job_source_bundle = JobSourceBundle(self.fake_bundle_name,
                                         self.fake_target_name)
     job_source_bundle.unbundle('../')
     mock_tar.extractall.assert_called()
 def test_unbundle_calls_tarfile_open_with_correct_arguments(self):
     archive_name = '{}{}.tgz'.format(self.fake_target_name,
                                      self.fake_bundle_name)
     job_source_bundle = JobSourceBundle(self.fake_bundle_name,
                                         self.fake_target_name)
     job_source_bundle.unbundle('../')
     self.mock_tarfile_open.assert_called_with(archive_name, 'r:gz')