Exemplo n.º 1
0
 def test_update_posts_to_expected_url(self, mock_connection, user_context,
                                       mock_detection_list_user_client):
     client = DepartingEmployeeService(mock_connection, user_context,
                                       mock_detection_list_user_client)
     client.update_departure_date(_USER_ID, "2022-12-20")
     assert mock_connection.post.call_args[0][
         0] == "v2/departingemployee/update"
Exemplo n.º 2
0
    def test_update_posts_expected_data(
        self,
        mock_connection,
        user_context,
        mock_get_all_response,
        mock_detection_list_user_client,
    ):
        client = DepartingEmployeeService(mock_connection, user_context,
                                          mock_detection_list_user_client)
        mock_connection.post.return_value = mock_get_all_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 = mock_connection.post.call_args[1]["json"]
        assert (posted_data["userId"] == _USER_ID
                and posted_data["tenantId"] == TENANT_ID_FROM_RESPONSE
                and posted_data["departureDate"] == "2020-12-20")