|
18 | 18 | """Test ``run`` command."""
|
19 | 19 |
|
20 | 20 | import os
|
| 21 | +from typing import cast |
21 | 22 |
|
22 | 23 | import pytest
|
23 | 24 |
|
| 25 | +from renku.domain_model.workflow.plan import Plan |
24 | 26 | from renku.infrastructure.gateway.activity_gateway import ActivityGateway
|
25 | 27 | from renku.infrastructure.gateway.plan_gateway import PlanGateway
|
26 | 28 | from renku.ui.cli import cli
|
@@ -118,6 +120,31 @@ def test_run_metadata(renku_cli, runner, client, client_database_injection_manag
|
118 | 120 | assert 0 == result.exit_code, format_result_exception(result)
|
119 | 121 |
|
120 | 122 |
|
| 123 | +def test_run_external_file(renku_cli, runner, client, client_database_injection_manager, tmpdir): |
| 124 | + """Test run with workflow metadata.""" |
| 125 | + |
| 126 | + external_file = tmpdir.join("file_1") |
| 127 | + external_file.write(str(1)) |
| 128 | + |
| 129 | + exit_code, activity = renku_cli("run", "--name", "run-1", "cp", str(external_file), "file_1") |
| 130 | + |
| 131 | + assert 0 == exit_code |
| 132 | + plan = activity.association.plan |
| 133 | + assert "run-1" == plan.name |
| 134 | + |
| 135 | + with client_database_injection_manager(client): |
| 136 | + plan_gateway = PlanGateway() |
| 137 | + plan = cast(Plan, plan_gateway.get_by_id(plan.id)) |
| 138 | + assert "run-1" == plan.name |
| 139 | + assert 1 == len(plan.parameters) |
| 140 | + assert 1 == len(plan.outputs) |
| 141 | + assert 0 == len(plan.inputs) |
| 142 | + assert plan.parameters[0].default_value == str(external_file) |
| 143 | + |
| 144 | + result = runner.invoke(cli, ["graph", "export", "--format", "json-ld", "--strict"]) |
| 145 | + assert 0 == result.exit_code, format_result_exception(result) |
| 146 | + |
| 147 | + |
121 | 148 | @pytest.mark.parametrize(
|
122 | 149 | "command, name",
|
123 | 150 | [
|
|
0 commit comments