Testing DNS authenticators?

I’m writing a DNS authenticator plugin for certbot for Azure DNS. I’m wanting to write some tests as per the developer guidelines, but I’m trying to get my head around how to write tests that call an external service that requires configuration and security credentials? For a test to be effective, I would imagine the need to register an actual domain and Azure subscription, and supply credentials for this in the tests; however, it wouldn’t really be possible for anyone else to run the test without registering their own.

Certainly, I could write tests for other things (e.g. failed credentials), but I’m wondering how to handle testing the ‘real thing’?

You might want to check out some of the DNS plugins currently coded for certbot at https://github.com/certbot/certbot

I’m sure they don’t all require test accounts for the tests. You probably can mock something to test the code functionality.

i would recommend that you us os.environment and ship the tests that way

you can also use the staging environment.

It depends on how deeply you want to test but you should have a domain, credentials and a real challenge to provision(valid testing)

PASSWORD = os.environ.get("")

That sounds decent; but presumably won’t work with CI tests.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.