def test_error_post_user_status(mock_requests, mock_error): mock_requests.post.return_value.status_code = 401 mock_requests.post.return_value.text = "unauthorized" api = PublicAPI("ABCD") api.post_user_status(username="******", status="coming") mock_error.assert_called_with( "Error while sending API call 'post user status': 401 unauthorized")
def test_error_post_user_status(mock_requests, mock_error): mock_requests.post.return_value.status_code = 401 mock_requests.post.return_value.text = "unauthorized" api = PublicAPI("ABCD") api.post_user_status( username = "******", status = "coming") mock_error.assert_called_with("Error while sending API call 'post user status': 401 unauthorized")
def test_post_user_status_minimal(mock_requests, mock_info): mock_requests.post.return_value.status_code = 204 api = PublicAPI(TOKEN) api.post_user_status( username = "******", status = "coming") mock_requests.post.assert_called_once_with( 'https://connectapi.feuersoftware.com/interfaces/public/operation/userstatus', data='{"username": "******", "status": "coming"}', headers={"authorization": f"bearer {TOKEN}", "accept": "application/json", "content-type": "application/json"}) mock_info.assert_called_with("Success, API call 'post user status' complete")
def test_post_user_status_minimal(mock_requests, mock_info): mock_requests.post.return_value.status_code = 204 api = PublicAPI(TOKEN) api.post_user_status(username="******", status="coming") mock_requests.post.assert_called_once_with( 'https://connectapi.feuersoftware.com/interfaces/public/operation/userstatus', data='{"username": "******", "status": "coming"}', headers={ "authorization": f"bearer {TOKEN}", "accept": "application/json", "content-type": "application/json" }) mock_info.assert_called_with( "Success, API call 'post user status' complete")