Commit 2f9d6d81 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: test list option

parent 4b04baad
......@@ -17,7 +17,7 @@ from . import make_archive, tempdir, server, mock_input, check_dir
def test_parseArgs():
# force can only be used when arguments are specified
# force can only be used when plugins are specified
fam.parseArgs('--force a.zip b.zip'.split())
with pytest.raises(SystemExit):
fam.parseArgs(['--force'])
......@@ -51,6 +51,7 @@ def test_loadManifest_different_sources():
]
# test
# - manifest from a URL
# - manifest from a file
# - invalid manifest
......@@ -154,6 +155,7 @@ def test_loadManifest_destination_specified():
'-d', dest1, '-d', dest2])
args = fam.parseArgs(['-m', 'manifest.json',
'-d', dest1, '-d', dest2,
'abc', 'def'])
m = fam.loadManifest(args)[0]
assert m['abc'].destination == op.abspath(dest1)
......@@ -407,6 +409,24 @@ def test_main_noargs():
[f'{archiveDir}/abc.zip'])
def test_main_list():
with tempdir() as cwd, server() as srv:
manifest = [
{'name' : 'abc', 'url' : f'{cwd}/abc.zip'},
{'name' : 'def', 'url' : f'http://localhost:{srv.port}/def.zip'},
]
with open('manifest.json', 'wt') as f:
f.write(json.dumps(manifest))
with mock.patch('fsl.scripts.fsl_add_module.MANIFEST_URL',
f'{cwd}/manifest.json'):
fam.main(['-l'])
fam.main('-l -v'.split())
fam.main('-l -m manifest.json'.split())
fam.main('-l -v -m manifest.json'.split())
def test_main_manifest_archiveDir():
with tempdir() as cwd, server() as srv:
......
......@@ -45,6 +45,23 @@ def test_downloadPluginManifest():
assert list(man.keys()) == []
def test_listPlugins():
testman = [
{ 'url' : 'http://abc.com/123' },
{ 'url' : 'http://abc.com/456', 'category':'cat1' },
{ 'url' : 'http://abc.com/789', 'category':'cat2' },
{ 'url' : 'http://abc.com/012', 'category':'cat3',
'description': 'Great plugin'}
]
with tempdir():
with open('manifest.json', 'wt') as f:
f.write(json.dumps(testman))
manifest = ui.downloadPluginManifest('manifest.json')
ui.listPlugins(manifest)
ui.listPlugins(manifest, True)
def test_createArchiveDir():
with tempdir():
ui.createArchiveDir(op.join('sub', 'dir', 'name'))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment