def test_update_posts_to_expected_url(self, mock_session, user_context,
                                       mock_detection_list_user_client):
     client = DepartingEmployeeClient(mock_session, user_context,
                                      mock_detection_list_user_client)
     client.update_departure_date(_USER_ID, "2022-12-20")
     assert mock_session.post.call_args[0][
         0] == "/svc/api/v2/departingemployee/update"
    def test_update_posts_expected_data(
        self,
        mock_session,
        user_context,
        mock_get_all_cases_response,
        mock_detection_list_user_client,
    ):
        client = DepartingEmployeeClient(mock_session, user_context,
                                         mock_detection_list_user_client)
        mock_session.post.return_value = mock_get_all_cases_response
        client.update_departure_date(_USER_ID, "2020-12-20")

        # Have to convert the request data to a dict because
        # older versions of Python don't have deterministic order.
        posted_data = json.loads(mock_session.post.call_args[1]["data"])
        assert (posted_data["userId"] == _USER_ID
                and posted_data["tenantId"] == TENANT_ID_FROM_RESPONSE
                and posted_data["departureDate"] == "2020-12-20")