@@ -1574,6 +1574,7 @@ def test_edit_post_success(self, mock_requests, mock_authenticate):
15741574 mock_requests .patch .return_value = mock_response
15751575 mock_authenticate .return_value = {"code" : 200 , "cookies" : self .cookie_jar }
15761576
1577+ # Edit post.
15771578 api = LoadingApiWrapper ("test@email.com" , "password" )
15781579 response = api .edit_post (
15791580 post_id = "000000000000000000000000" ,
@@ -1585,6 +1586,18 @@ def test_edit_post_success(self, mock_requests, mock_authenticate):
15851586 self .assertEqual (response .get ("code" ), 200 )
15861587 self .assertDictEqual (response .get ("data" ), expected_response )
15871588
1589+ # Edit thread.
1590+ api = LoadingApiWrapper ("test@email.com" , "password" )
1591+ response = api .edit_thread (
1592+ thread_id = "000000000000000000000000" ,
1593+ message = "updated message" ,
1594+ )
1595+
1596+ self .assertIsNotNone (api ._cookies )
1597+ self .assertEqual (api ._cookies , self .cookie_jar )
1598+ self .assertEqual (response .get ("code" ), 200 )
1599+ self .assertDictEqual (response .get ("data" ), expected_response )
1600+
15881601 @patch ("loading_api_wrapper.api.requests" )
15891602 def test_edit_post_failure_no_auth_token (self , mock_requests ):
15901603 status_code = 401
@@ -1595,11 +1608,21 @@ def test_edit_post_failure_no_auth_token(self, mock_requests):
15951608 mock_response .json .return_value = expected_response
15961609 mock_requests .patch .return_value = mock_response
15971610
1611+ # Edit post.
15981612 api = LoadingApiWrapper ()
15991613 response = api .edit_post (post_id = "post_id_to_edit" , message = "updated message" )
16001614
16011615 self .assertEqual (response , expected_response )
16021616
1617+ # Edit thread.
1618+ api = LoadingApiWrapper ()
1619+ response = api .edit_thread (
1620+ thread_id = "thread_id_to_edit" ,
1621+ message = "updated message" ,
1622+ )
1623+
1624+ self .assertEqual (response , expected_response )
1625+
16031626 @patch ("loading_api_wrapper.api.requests" )
16041627 def test_edit_post_failure_post_does_not_exist (self , mock_requests ):
16051628 status_code = 404
@@ -1610,9 +1633,20 @@ def test_edit_post_failure_post_does_not_exist(self, mock_requests):
16101633 mock_response .json .return_value = expected_response
16111634 mock_requests .patch .return_value = mock_response
16121635
1636+ # Edit post.
16131637 api = LoadingApiWrapper ()
16141638 response = api .edit_post (
1615- post_id = "non_existing_post_id" , message = "new updated message"
1639+ post_id = "non_existing_post_id" ,
1640+ message = "new updated message" ,
1641+ )
1642+
1643+ self .assertEqual (response , expected_response )
1644+
1645+ # Edit thread.
1646+ api = LoadingApiWrapper ()
1647+ response = api .edit_thread (
1648+ thread_id = "non_existing_thread_id" ,
1649+ message = "new updated message" ,
16161650 )
16171651
16181652 self .assertEqual (response , expected_response )
@@ -1626,13 +1660,22 @@ def test_edit_post_failure_empty_thread_id(self, mock_authenticate):
16261660
16271661 mock_authenticate .return_value = {"code" : 200 , "cookies" : self .cookie_jar }
16281662
1663+ # Edit post.
16291664 api = LoadingApiWrapper ("test@email.com" , "password" )
16301665 response = api .edit_post (post_id = "existing_post_id" , message = "" )
16311666
16321667 self .assertIsNotNone (api ._cookies )
16331668 self .assertEqual (api ._cookies , self .cookie_jar )
16341669 self .assertEqual (response , expected_response )
16351670
1671+ # Edit thread.
1672+ api = LoadingApiWrapper ("test@email.com" , "password" )
1673+ response = api .edit_thread (thread_id = "existing_thread_id" , message = "" )
1674+
1675+ self .assertIsNotNone (api ._cookies )
1676+ self .assertEqual (api ._cookies , self .cookie_jar )
1677+ self .assertEqual (response , expected_response )
1678+
16361679 @patch ("loading_api_wrapper.api.LoadingApiWrapper._authenticate" )
16371680 def test_create_post_failure_empty_thread_id (self , mock_authenticate ):
16381681 expected_response = {
0 commit comments