def test_import_from_issue_named(session): file_name = 'emx_package-only.xlsx' issue_num = 5693 run_commander('import --from-issue {} {}'.format(issue_num, file_name)) session.get_by_id('sys_md_Package', 'test') # cleanup get_test_context().get_issues_folder().joinpath(str(issue_num)).joinpath(file_name).unlink() session.delete('sys_md_Package', 'test')
def test_run_from_path(session): run_commander('run --from-path {}'.format( get_test_context().get_scripts_folder().joinpath('test_script'))) try: assert entity_type_exists(session, 'scripttest_testAutoId') assert package_exists(session, 'otherpackage') finally: session.delete('sys_md_Package', 'scripttest') session.delete('sys_md_Package', 'otherpackage')
def test_script_create(history, which_lines, what_filename): history.return_value = _history_lines which_lines.return_value = ['add user henk', 'add group test'] what_filename.return_value = 'test' with patch("builtins.open", mock_open()) as mock_file: run_commander('script') mock_file.assert_called_with( str(get_test_context().get_scripts_folder().joinpath('test')), 'w') mock_file().write.assert_has_calls( [mock.call('add user henk\n'), mock.call('add group test\n')])