| |
@@ -1567,6 +1567,17 @@
|
| |
self.destroy_lookaside_cache()
|
| |
super(TestSources, self).tearDown()
|
| |
|
| |
+ def _upload_unused(self):
|
| |
+ unused_patch = os.path.join(self.cloned_repo_path, 'unused.patch')
|
| |
+ self.write_file(unused_patch, content='+Welcome to UNUSED')
|
| |
+ cli_cmd = ['rpkg', '--path', self.cloned_repo_path,
|
| |
+ 'upload', unused_patch]
|
| |
+ with patch('sys.argv', new=cli_cmd):
|
| |
+ cli = self.new_cli()
|
| |
+ with patch('pyrpkg.lookaside.CGILookasideCache.upload', new=self.lookasidecache_upload):
|
| |
+ cli.upload()
|
| |
+ os.remove(unused_patch)
|
| |
+
|
| |
def test_sources(self):
|
| |
cli_cmd = ['rpkg', '--path', self.cloned_repo_path, 'sources']
|
| |
|
| |
@@ -1593,6 +1604,33 @@
|
| |
|
| |
self.assertFilesExist(['readme.patch'], search_dir=self.cloned_repo_path)
|
| |
|
| |
+ def test_unused_sources_are_not_downloaded(self):
|
| |
+ self._upload_unused()
|
| |
+
|
| |
+ cli_cmd = ['rpkg', '--path', self.cloned_repo_path, 'sources']
|
| |
+ with patch('sys.argv', new=cli_cmd):
|
| |
+ cli = self.new_cli()
|
| |
+ with patch('pyrpkg.lookaside.CGILookasideCache.download',
|
| |
+ new=self.lookasidecache_download):
|
| |
+ cli.sources()
|
| |
+
|
| |
+ path = os.path.join(self.cloned_repo_path, 'unused.patch')
|
| |
+ self.assertFalse(os.path.exists(path))
|
| |
+
|
| |
+ def test_force_option_downloads_unused_sources(self):
|
| |
+ self._upload_unused()
|
| |
+
|
| |
+ cli_cmd = ['rpkg', '--path', self.cloned_repo_path,
|
| |
+ 'sources', '--force']
|
| |
+ with patch('sys.argv', new=cli_cmd):
|
| |
+ cli = self.new_cli()
|
| |
+ with patch('pyrpkg.lookaside.CGILookasideCache.download',
|
| |
+ new=self.lookasidecache_download):
|
| |
+ cli.sources()
|
| |
+
|
| |
+ path = os.path.join(self.cloned_repo_path, 'unused.patch')
|
| |
+ self.assertTrue(os.path.exists(path))
|
| |
+
|
| |
|
| |
class TestFailureImportSrpm(CliTestCase):
|
| |
|
| |
In addition to actual package sources, the lookaside cache can also be used to store other files, such as test data.
Currently, the
sources
command only downloads files that are used in the specfile as Sources or Patches, making such use difficult.A new option
--force
is added, which allows downloading all sources without checking for usage.Fixes #650.