|
11 | 11 |
|
12 | 12 | from click.testing import CliRunner |
13 | 13 | from cernopendata_client.cli import get_file_locations |
14 | | -from cernopendata_client.config import SERVER_HTTPS_URI |
| 14 | +from cernopendata_client.config import SERVER_HTTPS_URI, SERVER_ROOT_URI |
15 | 15 |
|
16 | 16 |
|
17 | 17 | def test_get_file_locations_from_recid(): |
@@ -106,3 +106,27 @@ def test_get_file_locations_with_https_server_xrootd_protocol(): |
106 | 106 | ) |
107 | 107 | assert test_result.exit_code == 0 |
108 | 108 | assert "root://eospublic.cern.ch//eos/" in test_result.output |
| 109 | + |
| 110 | + |
| 111 | +def test_get_file_locations_no_expand_with_xrootd_protocol(): |
| 112 | + """Test `get-file-locations --no-expand --protocol xrootd` command.""" |
| 113 | + test_get_file_locations = CliRunner() |
| 114 | + test_result = test_get_file_locations.invoke( |
| 115 | + get_file_locations, |
| 116 | + ["--recid", 1, "--no-expand", "--protocol", "xrootd"], |
| 117 | + ) |
| 118 | + assert test_result.exit_code == 0 |
| 119 | + assert SERVER_ROOT_URI in test_result.output |
| 120 | + assert "file_index" in test_result.output |
| 121 | + |
| 122 | + |
| 123 | +def test_get_file_locations_no_expand_with_http_protocol(): |
| 124 | + """Test `get-file-locations --no-expand --protocol http` command.""" |
| 125 | + test_get_file_locations = CliRunner() |
| 126 | + test_result = test_get_file_locations.invoke( |
| 127 | + get_file_locations, |
| 128 | + ["--recid", 1, "--no-expand", "--protocol", "http"], |
| 129 | + ) |
| 130 | + assert test_result.exit_code == 0 |
| 131 | + assert "http://opendata.cern.ch" in test_result.output |
| 132 | + assert "file_index" in test_result.output |
0 commit comments