def test_error_delete_news(mock_requests, mock_error): mock_requests.delete.return_value.status_code = 401 mock_requests.delete.return_value.text = "unauthorized" api = PublicAPI("ABCD") api.delete_news(1) mock_error.assert_called_with( "Error while sending API call 'delete news': 401 unauthorized")
def test_delete_news(mock_requests, mock_info): mock_requests.delete.return_value.status_code = 204 api = PublicAPI(TOKEN) api.delete_news(1) mock_requests.delete.assert_called_once_with( f"https://connectapi.feuersoftware.com/interfaces/public/news/1", headers={"authorization": f"bearer {TOKEN}", "accept": "application/json", "content-type": "application/json"}) mock_info.assert_called_with("Success, API call 'delete news' complete")
def test_delete_news(mock_requests, mock_info): mock_requests.delete.return_value.status_code = 204 api = PublicAPI(TOKEN) api.delete_news(1) mock_requests.delete.assert_called_once_with( f"https://connectapi.feuersoftware.com/interfaces/public/news/1", headers={ "authorization": f"bearer {TOKEN}", "accept": "application/json", "content-type": "application/json" }) mock_info.assert_called_with("Success, API call 'delete news' complete")
def test_error_delete_news(mock_requests, mock_error): mock_requests.delete.return_value.status_code = 401 mock_requests.delete.return_value.text = "unauthorized" api = PublicAPI("ABCD") api.delete_news(1) mock_error.assert_called_with("Error while sending API call 'delete news': 401 unauthorized")