def test_bad_create_download_path(self, mock_create_bundle): """Test the creation of the download path for a cart file.""" test_cart = self.create_sample_cart() test_file = self.create_sample_file(test_cart) cart_utils = Cartutils() mock_create_bundle.side_effect = OSError(mock.Mock(), 'Error') success = cart_utils.create_download_path(test_file, test_cart, test_file.bundle_path) self.assertEqual(success, False)
def test_create_download_path(self): """Test the creation of the download path for a cart file.""" test_cart = self.create_sample_cart() test_file = self.create_sample_file(test_cart) cart_utils = Cartutils() success = cart_utils.create_download_path(test_file, test_cart, test_file.bundle_path) directory_name = os.path.dirname(test_file.bundle_path) self.assertEqual(success, True) self.assertEqual(os.path.isdir(directory_name), True) os.rmdir(directory_name) self.assertEqual(os.path.isdir(directory_name), False)