1010
1111
1212@pytest .fixture (name = "codingamer" )
13- async def get_codingamer (auth_client ) -> CodinGamer :
13+ async def get_codingamer (auth_client , mock_http ) -> CodinGamer :
14+ mock_http (auth_client ._state .http , "get_codingamer_from_handle" )
1415 return await auth_client .get_codingamer (
1516 os .environ .get ("TEST_CODINGAMER_PUBLIC_HANDLE" )
1617 )
1718
1819
19- async def test_codingamer_avatar_and_cover_urls (client : AsyncClient ):
20- codingamer = await client .get_codingamer ("Takos" )
20+ async def test_codingamer_avatar_and_cover_urls (client : AsyncClient , mock_http ):
21+ mock_http (client ._state .http , "get_codingamer_from_handle" )
22+ codingamer = await client .get_codingamer (
23+ os .environ .get ("TEST_CODINGAMER_PUBLIC_HANDLE" )
24+ )
2125 assert isinstance (codingamer .avatar_url , str )
2226 assert isinstance (codingamer .cover_url , str )
2327 assert isinstance (codingamer .profile_url , str )
2428
2529
26- async def test_codingamer_eq (client : AsyncClient , codingamer : CodinGamer ):
30+ async def test_codingamer_eq (
31+ client : AsyncClient , codingamer : CodinGamer , mock_http
32+ ):
33+ mock_http (client ._state .http , "get_codingamer_from_handle" )
2734 other_codingamer = await client .get_codingamer (
2835 os .environ .get ("TEST_CODINGAMER_PUBLIC_HANDLE" )
2936 )
3037 assert codingamer == other_codingamer
3138
3239
33- async def test_codingamer_get_followers (codingamer : CodinGamer ):
40+ async def test_codingamer_get_followers (codingamer : CodinGamer , mock_http ):
41+ mock_http (codingamer ._state .http , "get_codingamer_followers" )
3442 async for follower in codingamer .get_followers ():
3543 assert isinstance (follower , CodinGamer )
3644
@@ -43,13 +51,15 @@ async def test_codingamer_get_followers_error(client: AsyncClient):
4351 next (await codingamer .get_followers ())
4452
4553
46- async def test_codingamer_get_followers_ids (codingamer : CodinGamer ):
54+ async def test_codingamer_get_followers_ids (codingamer : CodinGamer , mock_http ):
55+ mock_http (codingamer ._state .http , "get_codingamer_follower_ids" )
4756 followers_ids = await codingamer .get_followers_ids ()
4857 assert isinstance (followers_ids , list )
4958 assert all (isinstance (follower_id , int ) for follower_id in followers_ids )
5059
5160
52- async def test_codingamer_get_followed (codingamer : CodinGamer ):
61+ async def test_codingamer_get_followed (codingamer : CodinGamer , mock_http ):
62+ mock_http (codingamer ._state .http , "get_codingamer_following" )
5363 async for followed in codingamer .get_followed ():
5464 assert isinstance (followed , CodinGamer )
5565
@@ -62,12 +72,16 @@ async def test_codingamer_get_followed_error(client: AsyncClient):
6272 next (await codingamer .get_followed ())
6373
6474
65- async def test_codingamer_get_followed_ids (codingamer : CodinGamer ):
75+ async def test_codingamer_get_followed_ids (codingamer : CodinGamer , mock_http ):
76+ mock_http (codingamer ._state .http , "get_codingamer_following_ids" )
6677 followed_ids = await codingamer .get_followed_ids ()
6778 assert isinstance (followed_ids , list )
6879 assert all (isinstance (followed_id , int ) for followed_id in followed_ids )
6980
7081
71- async def test_codingamer_get_clash_of_code_rank (codingamer : CodinGamer ):
82+ async def test_codingamer_get_clash_of_code_rank (
83+ codingamer : CodinGamer , mock_http
84+ ):
85+ mock_http (codingamer ._state .http , "get_codingamer_clash_of_code_rank" )
7286 rank = await codingamer .get_clash_of_code_rank ()
7387 assert isinstance (rank , int )
0 commit comments