@@ -50,7 +50,7 @@ async def test_app(aresponses):
5050
5151@pytest .mark .asyncio
5252async def test_calendar (aresponses ):
53- """Test calendar is handled correctly."""
53+ """Test calendar method is handled correctly."""
5454 aresponses .add (
5555 MATCH_HOST ,
5656 "/api/calendar?start=2014-01-26&end=2014-01-27" ,
@@ -74,9 +74,56 @@ async def test_calendar(aresponses):
7474 assert isinstance (response [0 ], models .Episode )
7575
7676
77+ @pytest .mark .asyncio
78+ async def test_commands (aresponses ):
79+ """Test commands method is handled correctly."""
80+ aresponses .add (
81+ MATCH_HOST ,
82+ "/api/command" ,
83+ "GET" ,
84+ aresponses .Response (
85+ status = 200 ,
86+ headers = {"Content-Type" : "application/json" },
87+ text = load_fixture ("command.json" ),
88+ ),
89+ )
90+
91+ async with ClientSession () as session :
92+ client = Sonarr (HOST , API_KEY , session = session )
93+ response = await client .commands ()
94+
95+ assert response
96+ assert isinstance (response , List )
97+
98+ assert response [0 ]
99+ assert isinstance (response [0 ], models .CommandItem )
100+
101+
102+ @pytest .mark .asyncio
103+ async def test_command_status (aresponses ):
104+ """Test command_status method is handled correctly."""
105+ aresponses .add (
106+ MATCH_HOST ,
107+ "/api/command/368630" ,
108+ "GET" ,
109+ aresponses .Response (
110+ status = 200 ,
111+ headers = {"Content-Type" : "application/json" },
112+ text = load_fixture ("command-id.json" ),
113+ ),
114+ )
115+
116+ async with ClientSession () as session :
117+ client = Sonarr (HOST , API_KEY , session = session )
118+ response = await client .command_status (368630 )
119+
120+ assert response
121+ assert isinstance (response , models .CommandItem )
122+
123+
77124@pytest .mark .asyncio
78125async def test_queue (aresponses ):
79- """Test queue is handled correctly."""
126+ """Test queue method is handled correctly."""
80127 aresponses .add (
81128 MATCH_HOST ,
82129 "/api/queue" ,
@@ -103,7 +150,7 @@ async def test_queue(aresponses):
103150
104151@pytest .mark .asyncio
105152async def test_series (aresponses ):
106- """Test series is handled correctly."""
153+ """Test series method is handled correctly."""
107154 aresponses .add (
108155 MATCH_HOST ,
109156 "/api/series" ,
@@ -136,7 +183,7 @@ async def test_series(aresponses):
136183
137184@pytest .mark .asyncio
138185async def test_update (aresponses ):
139- """Test update is handled correctly."""
186+ """Test update method is handled correctly."""
140187 aresponses .add (
141188 MATCH_HOST ,
142189 "/api/system/status" ,
@@ -187,16 +234,17 @@ async def test_update(aresponses):
187234
188235@pytest .mark .asyncio
189236async def test_wanted (aresponses ):
190- """Test queue is handled correctly."""
237+ """Test queue method is handled correctly."""
191238 aresponses .add (
192239 MATCH_HOST ,
193- "/api/wanted/missing" ,
240+ "/api/wanted/missing?sortKey=airDateUtc&page=1&pageSize=10&sortDir=desc " ,
194241 "GET" ,
195242 aresponses .Response (
196243 status = 200 ,
197244 headers = {"Content-Type" : "application/json" },
198245 text = load_fixture ("wanted-missing.json" ),
199246 ),
247+ match_querystring = True ,
200248 )
201249
202250 async with ClientSession () as session :
0 commit comments