eu-digital-green-certificates / dgc-testdata

Repository for storing generated QR code data for testing.
Apache License 2.0
157 stars 218 forks source link

SE: Updated testfiles for 1.3.0 schema #334

Closed martin-lindstrom closed 3 years ago

martin-lindstrom commented 3 years ago

Updated SE testfiles where 1.3.0 schema version is used.

Note: The validity of DCC:s containing test entries are extended for testing purposes.

martin-lindstrom commented 3 years ago

@SchulzeStTSI @daniel-eder @bhavin-qryptal

Could you please check that the test script is OK regarding comparision of date-time. I get the following error:

tests/test_ehealth_certs.py:300: in test_cose_json
105
    assert _ordered(hcert) == _ordered(config_env[JSON])
106
E   AssertionError: assert [('dob', '195...er', '1.3.0')] == [('dob', '195...er', '1.3.0')]
107
E     At index 2 diff: ('t', [[('ci', 'URN:UVCI:01:SE:EHM/TARN89875439877'), ('co', 'SE'), ('is', 'Swedish eHealth Agency'), ('nm', 'Roche LightCycler qPCR'), ('sc', '2021-06-15T09:24:02.000000Z'), ('tc', 'Arlanda Airport Covid Center 1'), ('tg', '840539006'), ('tr', '260415000'), ('tt', 'LP6464-4')]]) != ('t', [[('ci', 'URN:UVCI:01:SE:EHM/TARN89875439877'), ('co', 'SE'), ('is', 'Swedish eHealth Agency'), ('nm', 'Roche LightCycler qPCR'), ('sc', '2021-06-15T09:24:02Z'), ('tc', 'Arlanda Airport Covid Center 1'), ('tg', '840539006'), ('tr', '260415000'), ('tt', 'LP6464-4')]])

I set the sc as 2021-06-15T09:24:02Z but the test script claims that it can find 2021-06-15T09:24:02.000000Z somewhere.

  1. I claim that 2021-06-15T09:24:02.000000Z isn't there. A dump of the CBOR-field states that sc has no fractions.
  2. The script shouldn't fail anyway since it represents the exact same date-time.

Could you please promptly check this?

martin-lindstrom commented 3 years ago

@SchulzeStTSI @daniel-eder @bhavin-qryptal

A little hint is that 3.json succeeds and the only difference is that it does not have the 0-tag for the sc-field. Can it be that the Python-code getting the datetime adds the fractions?

bhavin-qryptal commented 3 years ago

@martin-lindstrom , I am sorry for the inconvenience caused. It is bit of the limitation of current implementation. Python library provides sc value in datetime type, which is then converted into string for comparison. String conversion used fraction while converting datetime to string and causing comparison to fail.

If not a concern, could you modify JSON payload in the sample file to add ".000000" to sc values like in this image?

image

If you have concern with this suggestion, Python script would need some more tweaks to deal with such samples.

martin-lindstrom commented 3 years ago

@martin-lindstrom , I am sorry for the inconvenience caused. It is bit of the limitation of current implementation. Python library provides sc value in datetime type, which is then converted into string for comparison. String conversion used fraction while converting datetime to string and causing comparison to fail.

If not a concern, could you modify JSON payload in the sample file to add ".000000" to sc values like in this image?

image

If you have concern with this suggestion, Python script would need some more tweaks to deal with such samples.

No. The 1.3.0 spec states that no fractions should be used, so I will not modify any code regarding this. I am sorry.

You will have to fix the test, or disable it, in order to get fully functional test files in place.

bhavin-qryptal commented 3 years ago

@martin-lindstrom I have created https://github.com/eu-digital-green-certificates/dgc-testdata/pull/336 to fix this.

@daniel-eder , Please help approve https://github.com/eu-digital-green-certificates/dgc-testdata/pull/336