diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2021-01-17 16:37:27 +0000 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2021-01-17 16:37:27 +0000 |
commit | 1c366183fc1dd880363956cc17a6d6159cecbd05 (patch) | |
tree | d2b945df2516d0ea9d6840102d53ef6110c47508 /datamaps/tests/test_cli.py | |
parent | 82c8be2d89a1359c271bccc889986272fcb40d02 (diff) |
added flag to change input directory for import templates command
Diffstat (limited to 'datamaps/tests/test_cli.py')
-rw-r--r-- | datamaps/tests/test_cli.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/datamaps/tests/test_cli.py b/datamaps/tests/test_cli.py index aef977c..a3a832f 100644 --- a/datamaps/tests/test_cli.py +++ b/datamaps/tests/test_cli.py @@ -20,6 +20,30 @@ def _copy_resources_to_input(config, directory): ) +def test_import_from_user_defined_source_dir( + mock_config, resource_dir, caplog, temp_input_dir +): + runner = CliRunner() + mock_config.initialise() + caplog.set_level(logging.INFO) + for fl in os.listdir(resource_dir): + shutil.copy( + Path.cwd() / "datamaps" / "tests" / "resources" / fl, temp_input_dir + ) + result = runner.invoke(_import, ["templates", "-m", "--inputdir", temp_input_dir]) + assert result.exit_code == 0 + output = [x[2] for x in caplog.record_tuples] + found = False + for o in output: + if f"Reading datamap {temp_input_dir}/" in o: + found = True + break + if found: + assert True + else: + assert False, "Cannot find correct string" + + @pytest.mark.parametrize( "rowlimit,expected,exit_code", [ |