Skip to content

Commit 2c85ce6

Browse files
committed
fixes revoke and retire tests
1 parent 9c4e714 commit 2c85ce6

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

tests/test_tpp_token.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,27 +170,26 @@ def test_token_revoke_not_issued(self):
170170
def test_token_revoke_normal(self):
171171
req, cert = simple_enroll(self.tpp_conn, self.tpp_zone)
172172
rev_req = RevocationRequest(req_id=req.id)
173-
self.tpp_conn.revoke_cert(rev_req)
173+
revoke_data = self.tpp_conn.revoke_cert(rev_req)
174174
time.sleep(1)
175-
with self.assertRaises(Exception):
176-
self.tpp_conn.renew_cert(req)
175+
assert revoke_data['Success'] is True
176+
177177

178178
def test_token_revoke_without_disable(self):
179179
req, cert = simple_enroll(self.tpp_conn, self.tpp_zone)
180180
rev_req = RevocationRequest(req_id=req.id, disable=False)
181-
self.tpp_conn.revoke_cert(rev_req)
181+
revoke_data = self.tpp_conn.revoke_cert(rev_req)
182182
time.sleep(1)
183-
self.tpp_conn.renew_cert(req)
183+
assert revoke_data['Success'] is True
184184

185185
def test_token_revoke_normal_thumbprint(self):
186186
req, cert = simple_enroll(self.tpp_conn, self.tpp_zone)
187187
cert = x509.load_pem_x509_certificate(cert.cert.encode(), default_backend())
188188
thumbprint = binascii.hexlify(cert.fingerprint(hashes.SHA1())).decode()
189189
rev_req = RevocationRequest(thumbprint=thumbprint)
190-
self.tpp_conn.revoke_cert(rev_req)
190+
revoke_data = self.tpp_conn.revoke_cert(rev_req)
191191
time.sleep(1)
192-
with self.assertRaises(Exception):
193-
self.tpp_conn.renew_cert(req)
192+
assert revoke_data['Success'] is True
194193

195194
def test_tpp_token_enroll_valid_hours(self):
196195
cn = f"{random_word(10)}.venafi.example.com"
@@ -269,20 +268,18 @@ def test_revoke_access_token(self):
269268
enroll(self.tpp_conn, self.tpp_zone, cn)
270269

271270
def test_tpp_token_retire_cert_id(self):
272-
cn = f"{random_word(10)}.venafi.example.com"
273271
try:
274272
req, cert = simple_enroll(self.tpp_conn, self.tpp_zone)
275-
ret_data = retire_by_id(id=req.id)
273+
ret_data = retire_by_id(self.tpp_conn, req.id)
276274
assert ret_data['Success'] is True
277275
except Exception as err:
278-
self.fail(f"Error in tpp retire by id test: {err.message}")
276+
self.fail(f"Error in tpp retire by id test: {err}")
279277

280278
def test_tpp_token_retire_cert_thumbprint(self):
281-
cn = f"{random_word(10)}.venafi.example.com"
282279
try:
283280
req, cert = simple_enroll(self.tpp_conn, self.tpp_zone)
284281
cert = x509.load_pem_x509_certificate(cert.cert.encode(), default_backend())
285-
ret_data = retire_by_thumbprint(prev_cert=cert)
282+
ret_data = retire_by_thumbprint(self.tpp_conn, cert)
286283
assert ret_data['Success'] is True
287284
except Exception as err:
288-
self.fail(f"Error in tpp retire by thumbprint test: {err.message}")
285+
self.fail(f"Error in tpp retire by thumbprint test: {err}")

tests/test_vaas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_cloud_retire_by_thumbprint(self):
223223
fingerprint = binascii.hexlify(cert.fingerprint(hashes.SHA1())).decode()
224224
time.sleep(1)
225225
ret_request = RetireRequest(thumbprint=fingerprint)
226-
ret_data = self.cloud_conn.retire_cert(fingerprint)
226+
ret_data = self.cloud_conn.retire_cert(ret_request)
227227
assert ret_data is True
228228
except Exception as e:
229229
log.error(msg=f"Error retiring certificate by thumbprint: {e.message}")

0 commit comments

Comments
 (0)