@@ -151,6 +151,7 @@ def test_get_profile_success(self, mock_requests, mock_authenticate):
151151 self .assertIsNotNone (api ._cookies )
152152 self .assertEqual (api ._cookies , self .cookie_jar )
153153 self .assertEqual (response .get ("code" ), 200 )
154+ self .assertEqual (response .get ("message" ), "OK" )
154155 self .assertDictEqual (response .get ("data" ), expected_response )
155156
156157 @patch ("loading_sdk.api.requests" )
@@ -209,6 +210,7 @@ def test_search_success(self, mock_requests):
209210 response = api .search ("zGwszApFEcY" )
210211
211212 self .assertEqual (response .get ("code" ), 200 )
213+ self .assertEqual (response .get ("message" ), "OK" )
212214 self .assertEqual (response .get ("data" ), expected_response )
213215
214216 @patch ("loading_sdk.api.requests" )
@@ -224,6 +226,7 @@ def test_search_success_no_results(self, mock_requests):
224226 response = api .search ("zGwszApFEcYesf" )
225227
226228 self .assertEqual (response .get ("code" ), 200 )
229+ self .assertEqual (response .get ("message" ), "No results" )
227230 self .assertEqual (response .get ("data" ), expected_response )
228231
229232 @patch ("loading_sdk.api.requests" )
@@ -327,6 +330,7 @@ def test_get_post_success(self, mock_requests):
327330 response = api .get_post ("none_existing_post_id" )
328331
329332 self .assertEqual (response .get ("code" ), 200 )
333+ self .assertEqual (response .get ("message" ), "OK" )
330334 self .assertEqual (response .get ("data" ), expected_response )
331335
332336 @patch ("loading_sdk.api.requests" )
@@ -369,18 +373,21 @@ def test_get_thread_success(self, mock_requests):
369373 response = api .get_thread ("5f9e4e8c2c32e2001ed17170" )
370374
371375 self .assertEqual (response .get ("code" ), 200 )
376+ self .assertEqual (response .get ("message" ), "OK" )
372377 self .assertEqual (response .get ("data" ), expected_response )
373378
374379 api = LoadingApiClient ()
375380 response = api .get_thread ("5f9e4e8c2c32e2001ed17170" , page = 0 )
376381
377382 self .assertEqual (response .get ("code" ), 200 )
383+ self .assertEqual (response .get ("message" ), "OK" )
378384 self .assertEqual (response .get ("data" ), expected_response )
379385
380386 api = LoadingApiClient ()
381387 response = api .get_thread ("5f9e4e8c2c32e2001ed17170" , page = 1 )
382388
383389 self .assertEqual (response .get ("code" ), 200 )
390+ self .assertEqual (response .get ("message" ), "OK" )
384391 self .assertEqual (response .get ("data" ), expected_response )
385392
386393 @patch ("loading_sdk.api.requests" )
@@ -464,7 +471,11 @@ def test_get_thread_failure_does_not_exist(self, mock_requests):
464471 @patch ("loading_sdk.api.requests" )
465472 def test_get_thread_failure_page_too_low (self , mock_requests ):
466473 status_code = 200
467- expected_response = {"code" : 200 , "data" : {"posts" : [], "users" : []}}
474+ expected_response = {
475+ "code" : 200 ,
476+ "message" : "Page number too low" ,
477+ "data" : {"posts" : [], "users" : []},
478+ }
468479
469480 mock_response = MagicMock ()
470481 mock_response .status_code = status_code
@@ -506,7 +517,11 @@ def test_get_thread_failure_page_too_low(self, mock_requests):
506517 @patch ("loading_sdk.api.requests" )
507518 def test_get_thread_failure_page_too_high (self , mock_requests ):
508519 status_code = 200
509- expected_response = {"code" : 200 , "data" : {"posts" : [], "users" : []}}
520+ expected_response = {
521+ "code" : 200 ,
522+ "message" : "Page number too high" ,
523+ "data" : {"posts" : [], "users" : []},
524+ }
510525
511526 mock_response = MagicMock ()
512527 mock_response .status_code = status_code
@@ -543,6 +558,7 @@ def test_get_thread_failure_page_too_high(self, mock_requests):
543558 response = api .get_thread ("5f9e4e8c2c32e2001ed17170" , page = 2 )
544559
545560 self .assertEqual (response .get ("code" ), 200 )
561+ self .assertEqual (response .get ("message" ), "Page number too high" )
546562 self .assertEqual (response , expected_response )
547563
548564 @patch ("loading_sdk.api.requests" )
@@ -932,7 +948,11 @@ def test_get_games_success(self, mock_requests):
932948 @patch ("loading_sdk.api.requests" )
933949 def test_get_games_failure_page_too_low (self , mock_requests ):
934950 status_code = 404
935- expected_response = {"code" : status_code , "data" : {"posts" : [], "users" : []}}
951+ expected_response = {
952+ "code" : status_code ,
953+ "message" : "Page number too low" ,
954+ "data" : {"posts" : [], "users" : []},
955+ }
936956
937957 mock_response = MagicMock ()
938958 mock_response .status_code = status_code
@@ -947,7 +967,11 @@ def test_get_games_failure_page_too_low(self, mock_requests):
947967 @patch ("loading_sdk.api.requests" )
948968 def test_get_games_failure_page_too_high (self , mock_requests ):
949969 status_code = 404
950- expected_response = {"code" : status_code , "data" : {"posts" : [], "users" : []}}
970+ expected_response = {
971+ "code" : status_code ,
972+ "message" : "Page number too high" ,
973+ "data" : {"posts" : [], "users" : []},
974+ }
951975
952976 mock_response = MagicMock ()
953977 mock_response .status_code = status_code
@@ -1180,7 +1204,11 @@ def test_get_other_success(self, mock_requests):
11801204 @patch ("loading_sdk.api.requests" )
11811205 def test_get_other_failure_page_too_low (self , mock_requests ):
11821206 status_code = 404
1183- expected_response = {"code" : status_code , "data" : {"posts" : [], "users" : []}}
1207+ expected_response = {
1208+ "code" : status_code ,
1209+ "message" : "Page number too low" ,
1210+ "data" : {"posts" : [], "users" : []},
1211+ }
11841212
11851213 mock_response = MagicMock ()
11861214 mock_response .status_code = status_code
@@ -1195,7 +1223,11 @@ def test_get_other_failure_page_too_low(self, mock_requests):
11951223 @patch ("loading_sdk.api.requests" )
11961224 def test_get_other_failure_page_too_high (self , mock_requests ):
11971225 status_code = 404
1198- expected_response = {"code" : status_code , "data" : {"posts" : [], "users" : []}}
1226+ expected_response = {
1227+ "code" : status_code ,
1228+ "message" : "Page number too high" ,
1229+ "data" : {"posts" : [], "users" : []},
1230+ }
11991231
12001232 mock_response = MagicMock ()
12011233 mock_response .status_code = status_code
@@ -1505,6 +1537,8 @@ def test_get_editorials_success(self, mock_requests):
15051537 api = LoadingApiClient ()
15061538 response = api .get_editorials (page = 1 , post_type = "update" , sort = "title" )
15071539
1540+ self .assertEqual (response .get ("code" ), 200 )
1541+ self .assertEqual (response .get ("message" ), "OK" )
15081542 self .assertDictEqual (response .get ("data" ), expected_response )
15091543
15101544 threads = response .get ("data" ).get ("posts" )
@@ -1515,7 +1549,11 @@ def test_get_editorials_success(self, mock_requests):
15151549 @patch ("loading_sdk.api.requests" )
15161550 def test_get_editorials_failure_page_too_low (self , mock_requests ):
15171551 status_code = 404
1518- expected_response = {"code" : status_code , "data" : {"posts" : [], "users" : []}}
1552+ expected_response = {
1553+ "code" : status_code ,
1554+ "message" : "Page number too low" ,
1555+ "data" : {"posts" : [], "users" : []},
1556+ }
15191557
15201558 mock_response = MagicMock ()
15211559 mock_response .status_code = status_code
@@ -1534,7 +1572,11 @@ def test_get_editorials_failure_page_too_low(self, mock_requests):
15341572 @patch ("loading_sdk.api.requests" )
15351573 def test_get_editorials_failure_page_too_high (self , mock_requests ):
15361574 status_code = 404
1537- expected_response = {"code" : status_code , "data" : {"posts" : [], "users" : []}}
1575+ expected_response = {
1576+ "code" : status_code ,
1577+ "message" : "Page number too high" ,
1578+ "data" : {"posts" : [], "users" : []},
1579+ }
15381580
15391581 mock_response = MagicMock ()
15401582 mock_response .status_code = status_code
0 commit comments