1- import pytest
21import resend
32from resend .exceptions import NoContentError
43from tests .conftest import ResendBaseTest
76
87
98class TestResendApiKeysAsync (ResendBaseTest ):
10- @pytest .mark .asyncio
119 async def test_api_keys_create_async (self ) -> None :
1210 self .set_mock_json (
1311 {
@@ -22,16 +20,16 @@ async def test_api_keys_create_async(self) -> None:
2220 key : resend .ApiKey = await resend .ApiKeys .create_async (params )
2321 assert key ["id" ] == "dacf4072-4119-4d88-932f-6202748ac7c8"
2422
25- @pytest .mark .asyncio
26- async def test_should_create_api_key_async_raise_exception_when_no_content (self ) -> None :
23+ async def test_should_create_api_key_async_raise_exception_when_no_content (
24+ self ,
25+ ) -> None :
2726 self .set_mock_json (None )
2827 params : resend .ApiKeys .CreateParams = {
2928 "name" : "prod" ,
3029 }
3130 with self .assertRaises (NoContentError ):
3231 _ = await resend .ApiKeys .create_async (params )
3332
34- @pytest .mark .asyncio
3533 async def test_api_keys_list_async (self ) -> None :
3634 self .set_mock_json (
3735 {
@@ -51,19 +49,17 @@ async def test_api_keys_list_async(self) -> None:
5149 assert key ["name" ] == "Production"
5250 assert key ["created_at" ] == "2023-04-08T00:11:13.110779+00:00"
5351
54- @pytest .mark .asyncio
55- async def test_should_list_api_key_async_raise_exception_when_no_content (self ) -> None :
52+ async def test_should_list_api_key_async_raise_exception_when_no_content (
53+ self ,
54+ ) -> None :
5655 self .set_mock_json (None )
5756 with self .assertRaises (NoContentError ):
5857 _ = await resend .ApiKeys .list_async ()
5958
60- @pytest .mark .asyncio
6159 async def test_api_keys_remove_async (self ) -> None :
6260 self .set_mock_text ("" )
6361
64- assert (
65- await resend .ApiKeys .remove_async (
66- api_key_id = "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ,
67- )
68- is None
69- )
62+ # Remove operation returns None, verify no exceptions raised
63+ await resend .ApiKeys .remove_async (
64+ api_key_id = "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ,
65+ )
0 commit comments