Revize b6167335
Přidáno uživatelem Michal Seják před téměř 4 roky(ů)
tests/integration_tests/services/crl_service_test.py | ||
---|---|---|
13 | 13 |
|
14 | 14 |
CA_INDEX_DATE_FORMAT = "%y%m%d%H%M%SZ" |
15 | 15 |
|
16 |
CRL_DATE_FORMAT = "%b %d %H:%M:%S %Y" |
|
16 |
CRL_DATE_FORMAT_PT_1 = "%b %d " |
|
17 |
CRL_DATE_FORMAT_PT_2 = "%H:%M:%S %Y" |
|
17 | 18 |
|
18 | 19 |
|
19 | 20 |
def convert_valid_to_date_to_ca_index_format(date): |
... | ... | |
25 | 26 |
|
26 | 27 |
|
27 | 28 |
def convert_date_to_crl_format(date): |
28 |
return f"{time.strftime(CRL_DATE_FORMAT, date)} GMT" |
|
29 |
# replace leading zeroes by leading spaces |
|
30 |
return f"{time.strftime(CRL_DATE_FORMAT_PT_1, date)}".replace(" 0", " ") + \ |
|
31 |
f"{time.strftime(CRL_DATE_FORMAT_PT_2, date)} GMT" |
|
29 | 32 |
|
30 | 33 |
|
31 | 34 |
def test_set_certificate_revoked(certificate_service_unique, private_key_service_unique, crl_service_unique, |
... | ... | |
176 | 179 |
X509v3 CRL Reason Code: |
177 | 180 |
CA Compromise |
178 | 181 |
""" % (revoked_dates[0], revoked_dates[1], revoked_dates[2]) |
182 |
|
|
179 | 183 |
expected = expected.strip().replace("\r", "").replace("\n", "") |
180 | 184 |
out = out.decode("utf-8").strip().replace("\r", "").replace("\n", "") |
185 |
|
|
186 |
with open("expected", "w") as f: |
|
187 |
f.write(expected) |
|
188 |
with open("actual", "w") as f: |
|
189 |
f.write(out) |
|
190 |
|
|
181 | 191 |
assert expected in out |
182 | 192 |
|
183 | 193 |
# test reaction of the service is unknown certificate is being queried |
Také k dispozici: Unified diff
Re #8700 - Fixed a test bug related to date format differences.