|
16 | 16 | # See the License for the specific language governing permissions and |
17 | 17 | # limitations under the License. |
18 | 18 | # ---license-end |
19 | | -# |
20 | | -# Dependencies: |
21 | | -# Python 3.9 |
22 | | -# pip install -r tests/requirements.txt |
23 | | -# |
24 | | -# Usage: |
25 | | -# To run all tests: pytest |
26 | | -# To run tests for a given country: pytest -C=<Country Code> . e.g. pytest -C=AT |
27 | 19 |
|
28 | 20 | import json |
29 | 21 | from base64 import b64decode |
30 | 22 | import base64 |
31 | | -import os |
32 | 23 | from os import path |
33 | 24 | from pathlib import Path |
34 | 25 | from io import BytesIO |
|
82 | 73 | def pytest_generate_tests(metafunc): |
83 | 74 | if "config_env" in metafunc.fixturenames: |
84 | 75 | country_code = metafunc.config.getoption("country_code") |
| 76 | + file_name = metafunc.config.getoption("file_name") |
85 | 77 | test_dir = path.dirname(path.dirname(path.abspath(__file__))) |
86 | 78 | test_files = glob( |
87 | 79 | str(Path(test_dir, country_code, "*", "*.png")), recursive=True) |
@@ -271,8 +263,8 @@ def test_issuer_quality(config_env: Dict): |
271 | 263 |
|
272 | 264 | # If file path indicates JSON schema version, verify it against actual JSON schema version |
273 | 265 | # E.g. "<countrycode>/1.0.0/VAC.png" will trigger schema version verification, whereas "<countrycode>/1.0.0/exceptions/VAC.png" will not |
274 | | - if re.search("\\d\\.\\d\\.\\d", config_env[FILE_PATH].split(os.sep)[-2]): |
275 | | - path_schema_version = config_env[FILE_PATH].split(os.sep)[-2] |
| 266 | + if re.search("\\d\\.\\d\\.\\d", config_env[FILE_PATH].split("/")[-2]): |
| 267 | + path_schema_version = config_env[FILE_PATH].split("/")[-2] |
276 | 268 | dcc_schema_version = cose_payload[PAYLOAD_HCERT][PAYLOAD_ISSUER][VER] |
277 | 269 | if path_schema_version != dcc_schema_version: |
278 | 270 | fail("File path indicates {} but DCC contains {} JSON schema version".format( |
|
0 commit comments