Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/test_local_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,26 @@ def test_return_pem_cert(self):
cert = conn.retrieve_cert(req)
self.assertIn("BEGIN CERTIFICATE", cert.cert)

def test_fake_read_zone_conf_returns_zone_config(self):
# Regression: FakeConnection previously defined read_zone_conf twice; the second definition
# raised NotImplementedError and shadowed the working one, breaking test_mode enrollment.
conn = FakeConnection()
z = conn.read_zone_conf("")
self.assertIsInstance(z, ZoneConfig)
self.assertTrue(len(z.policy.key_types) > 0)
self.assertEqual(z.policy.key_types[0].key_type, KeyType.RSA)

def test_fake_enroll_reads_zone_conf(self):
# Mirrors the test_mode enroll flow used by the ansible collection: read the zone config,
# apply it to the request, then request + retrieve. Must not raise NotImplementedError.
conn = FakeConnection()
z = conn.read_zone_conf("")
req = CertificateRequest(common_name="test.example.com")
req.update_from_zone_config(z)
conn.request_cert(req, "")
cert = conn.retrieve_cert(req)
self.assertIn("BEGIN CERTIFICATE", cert.cert)

def test_tpp_url_normalization(self):
conn = TPPConnection(url="localhost", user="user", password="password")
self.assertEqual(conn._base_url, "https://localhost/")
Expand Down
3 changes: 0 additions & 3 deletions vcert/connection_fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ def renew_cert(self, request, reuse_key=False):
log.debug("Renew is not supported in test mode.")
raise NotImplementedError

def read_zone_conf(self, tag):
raise NotImplementedError

def import_cert(self, request):
raise NotImplementedError

Expand Down