feat: add domain claims endpoints#228
Conversation
Adds Domains.Claims sub-resource with create, get, and verify methods
(plus _async variants) covering the new Domain Claims API:
- POST /domains/claim
- GET /domains/{domain_id}/claim
- POST /domains/{domain_id}/claim/verify
There was a problem hiding this comment.
4 issues found across 8 files
Confidence score: 4/5
- The biggest risk is in
tests/domain_claims_async_test.py: there’s no async test coveringcreatewith all optional parameters, so async-specific regressions incustom_return_path, tracking flags, ortracking_subdomaincould slip through unnoticed—add a parity test matching the synctest_domain_claims_create_with_optionsbefore merging. - Also in
tests/domain_claims_async_test.py, multiple test names useshould, which conflicts with repo conventions and can add churn in future test maintenance/reviews—rename these tests to direct declarative names to align with project standards.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/domain_claims_async_test.py">
<violation number="1" location="tests/domain_claims_async_test.py:1">
P2: Missing async test for create with all optional parameters. The sync file has `test_domain_claims_create_with_options` that exercises `custom_return_path`, `open_tracking`, `click_tracking`, and `tracking_subdomain`. The async file should include an equivalent test to catch serialization or handling bugs in the async request path for these optional fields.</violation>
<violation number="2" location="tests/domain_claims_async_test.py:44">
P2: Custom agent: **No `should` in tests**
These test method names include the word 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead. For example, rename `test_should_create_domain_claim_async_raise_exception_when_no_content` to something like `test_create_domain_claim_async_raises_exception_when_no_content`.</violation>
<violation number="3" location="tests/domain_claims_async_test.py:75">
P2: Custom agent: **No `should` in tests**
This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as `test_get_domain_claim_async_raises_exception_when_no_content`.</violation>
<violation number="4" location="tests/domain_claims_async_test.py:102">
P2: Custom agent: **No `should` in tests**
This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as `test_verify_domain_claim_async_raises_exception_when_no_content`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| @@ -0,0 +1,109 @@ | |||
| import pytest | |||
There was a problem hiding this comment.
P2: Missing async test for create with all optional parameters. The sync file has test_domain_claims_create_with_options that exercises custom_return_path, open_tracking, click_tracking, and tracking_subdomain. The async file should include an equivalent test to catch serialization or handling bugs in the async request path for these optional fields.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/domain_claims_async_test.py:
<comment>Missing async test for create with all optional parameters. The sync file has `test_domain_claims_create_with_options` that exercises `custom_return_path`, `open_tracking`, `click_tracking`, and `tracking_subdomain`. The async file should include an equivalent test to catch serialization or handling bugs in the async request path for these optional fields.</comment>
<file context>
@@ -0,0 +1,109 @@
+import pytest
+
+import resend
+from resend.exceptions import NoContentError
+from tests.conftest import AsyncResendBaseTest
+
+# flake8: noqa
+
+pytestmark = pytest.mark.asyncio
</file context>
| assert claim["id"] == "dacf4072-4119-4d88-932f-6c6126d3a9d1" | ||
| assert claim["status"] == "pending" | ||
|
|
||
| async def test_should_verify_domain_claim_async_raise_exception_when_no_content( |
There was a problem hiding this comment.
P2: Custom agent: No should in tests
This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as test_verify_domain_claim_async_raises_exception_when_no_content.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/domain_claims_async_test.py, line 102:
<comment>This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as `test_verify_domain_claim_async_raises_exception_when_no_content`.</comment>
<file context>
@@ -0,0 +1,109 @@
+ assert claim["id"] == "dacf4072-4119-4d88-932f-6c6126d3a9d1"
+ assert claim["status"] == "pending"
+
+ async def test_should_verify_domain_claim_async_raise_exception_when_no_content(
+ self,
+ ) -> None:
</file context>
| async def test_should_verify_domain_claim_async_raise_exception_when_no_content( | |
| async def test_verify_domain_claim_async_raises_exception_when_no_content( |
| assert claim["status"] == "blocked" | ||
| assert claim["blocked_reason"] == "grace_period" | ||
|
|
||
| async def test_should_get_domain_claim_async_raise_exception_when_no_content( |
There was a problem hiding this comment.
P2: Custom agent: No should in tests
This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as test_get_domain_claim_async_raises_exception_when_no_content.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/domain_claims_async_test.py, line 75:
<comment>This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as `test_get_domain_claim_async_raises_exception_when_no_content`.</comment>
<file context>
@@ -0,0 +1,109 @@
+ assert claim["status"] == "blocked"
+ assert claim["blocked_reason"] == "grace_period"
+
+ async def test_should_get_domain_claim_async_raise_exception_when_no_content(
+ self,
+ ) -> None:
</file context>
| async def test_should_get_domain_claim_async_raise_exception_when_no_content( | |
| async def test_get_domain_claim_async_raises_exception_when_no_content( |
| assert claim["status"] == "pending" | ||
| assert claim["record"]["type"] == "TXT" | ||
|
|
||
| async def test_should_create_domain_claim_async_raise_exception_when_no_content( |
There was a problem hiding this comment.
P2: Custom agent: No should in tests
These test method names include the word 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead. For example, rename test_should_create_domain_claim_async_raise_exception_when_no_content to something like test_create_domain_claim_async_raises_exception_when_no_content.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/domain_claims_async_test.py, line 44:
<comment>These test method names include the word 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead. For example, rename `test_should_create_domain_claim_async_raise_exception_when_no_content` to something like `test_create_domain_claim_async_raises_exception_when_no_content`.</comment>
<file context>
@@ -0,0 +1,109 @@
+ assert claim["status"] == "pending"
+ assert claim["record"]["type"] == "TXT"
+
+ async def test_should_create_domain_claim_async_raise_exception_when_no_content(
+ self,
+ ) -> None:
</file context>
| async def test_should_create_domain_claim_async_raise_exception_when_no_content( | |
| async def test_create_domain_claim_async_raises_exception_when_no_content( |
Adds Domains.Claims sub-resource with create, get, and verify methods (plus _async variants) covering the new Domain Claims API:
Summary by cubic
Add Domain Claims API support with
Domains.Claimsmethods to create, get, and verify claims (sync and async) so users can claim already-verified domains. Exposes claim types inresendand includes an example and tests.Domains.Claims.create(params)→ POST/domains/claimDomains.Claims.get(domain_id)→ GET/domains/{domain_id}/claimDomains.Claims.verify(domain_id)→ POST/domains/{domain_id}/claim/verifycreate_async,get_async,verify_asyncresend:DomainClaims,DomainClaim,DomainClaimRecordexamples/domain_claims.pyand sync/async testsWritten for commit 59a6e64. Summary will update on new commits.