Exemplo n.º 1
0
    def test_get_all_posts_expected_data_with_non_default_values(
        self, user_context, mock_connection, mock_detection_list_user_client
    ):
        client = DepartingEmployeeService(
            mock_connection, user_context, mock_detection_list_user_client
        )

        for _ in client.get_all(
            filter_type="NEW_FILTER",
            sort_direction="DESC",
            sort_key="DISPLAY_NAME",
            page_size=200,
        ):
            break

        posted_data = mock_connection.post.call_args[1]["json"]
        assert mock_connection.post.call_count == 1
        assert (
            mock_connection.post.call_args[0][0]
            == "/svc/api/v2/departingemployee/search"
        )
        assert (
            posted_data["tenantId"] == user_context.get_current_tenant_id()
            and posted_data["filterType"] == "NEW_FILTER"
            and posted_data["pgNum"] == 1
            and posted_data["pgSize"] == 200
            and posted_data["srtKey"] == "DISPLAY_NAME"
            and posted_data["srtDirection"] == "DESC"
        )
Exemplo n.º 2
0
 def test_get_all_posts_expected_data_to_expected_url(
     self,
     mock_connection,
     user_context,
     mock_get_all_cases_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_cases_response
     for _ in client.get_all():
         break
     first_call = mock_connection.post.call_args_list[0]
     posted_data = first_call[1]["json"]
     assert (
         posted_data["tenantId"] == TENANT_ID_FROM_RESPONSE
         and posted_data["pgSize"] == 100
         and posted_data["pgNum"] == 1
         and posted_data["filterType"] == "OPEN"
         and posted_data["srtKey"] == "CREATED_AT"
         and posted_data["srtDirection"] == "DESC"
     )
     assert (
         mock_connection.post.call_args[0][0]
         == "/svc/api/v2/departingemployee/search"
     )
     assert mock_connection.post.call_count == 1