From effbcd15e3fdf639b019e19283e1a49edd55eb82 Mon Sep 17 00:00:00 2001 From: Arian Nasr Date: Sun, 15 Mar 2026 17:29:10 -0400 Subject: [PATCH] tests for schemas --- .gitignore | 3 ++- requirements.txt | 3 ++- test_schemas.py | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test_schemas.py diff --git a/.gitignore b/.gitignore index 62416fa..6205f3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ .venv/ -.secrets/ \ No newline at end of file +.secrets/ +__pycache__/ \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9c9919f..ca7bcad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ certbot==5.4.0 certbot-dns-cloudflare==5.4.0 -pydantic==2.12.5 \ No newline at end of file +pydantic==2.12.5 +email-validator==2.3.0 \ No newline at end of file diff --git a/test_schemas.py b/test_schemas.py new file mode 100644 index 0000000..2ad0ce9 --- /dev/null +++ b/test_schemas.py @@ -0,0 +1,18 @@ +test_domain_request = { + 'domain': 'example.com', + 'credentials_file': '.secrets.example/certbot/cloudflare.ini', + 'email': 'admin@example.com' +} + +if __name__ == '__main__': + from schemas import DomainRequest + from pydantic import ValidationError + + try: + domain_request = DomainRequest(**test_domain_request) + print("DomainRequest validation successful:", domain_request) + except ValidationError as e: + print("DomainRequest validation failed:", e) + except Exception as e: + print("An unexpected error occurred:", e) + raise e \ No newline at end of file