feat(DX-3233): Bulk publish/unpublish query params, api_version tests, and robust error handling#136
Open
OMpawar-21 wants to merge 5 commits intodevelopmentfrom
Open
feat(DX-3233): Bulk publish/unpublish query params, api_version tests, and robust error handling#136OMpawar-21 wants to merge 5 commits intodevelopmentfrom
OMpawar-21 wants to merge 5 commits intodevelopmentfrom
Conversation
…BulkUnpublishService.cs.
Description
In BulkUnpublishService.cs, two comment-only lines were added to document an alternative way of sending the bulk unpublish options:
skip_workflow_stage_check – A commented call AddQueryResource("skip_workflow_stage_check", "true") was added next to the existing Headers["skip_workflow_stage_check"] = "true" assignment.
approvals – A commented call AddQueryResource("approvals", "true") was added next to the existing Headers["approvals"] = "true" assignment.
…add integration tests - Bulk publish/unpublish: send skip_workflow_stage_check and approvals as query params via AddQueryResource instead of headers (BulkPublishService; BulkUnpublishService already used query params). - Unit tests: in BulkPublishServiceTest, BulkUnpublishServiceTest, and BulkOperationServicesTest, assert on QueryResources instead of Headers for these two flags. - Integration tests: add EnsureBulkTestContentTypeAndEntriesAsync() so bulk_test_content_type and at least one entry exist; add Test003a (bulk publish with skipWorkflowStage and approvals) and Test004a (bulk unpublish with same flags).
…ndling Integration tests (Contentstack015_BulkOperationTest): - API version 3.2: - Test003b: bulk publish with skipWorkflowStage, approvals, and apiVersion "3.2" (api_version header). - Test004b: bulk unpublish with skipWorkflowStage, approvals, and apiVersion "3.2" (api_version header). - Error handling and assertions: - Add FailWithError(operation, ex) to report HTTP status, ErrorCode, and API message on ContentstackErrorException. - In Test003a, Test004a, Test003b, Test004b: assert response.StatusCode == HttpStatusCode.OK and use FailWithError in catch. - Add Test004c: negative test for bulk unpublish with invalid data (empty entries, non-existent env); expect ContentstackErrorException and assert non-success status and presence of error message. - Usings: System.Net (HttpStatusCode), Contentstack.Management.Core.Exceptions (ContentstackErrorException).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title
feat(DX-3233): Bulk publish/unpublish query params, api_version tests, and robust error handling
Summary
skip_workflow_stage_checkandapprovalsas query parameters (not headers) for bulk publish/unpublish.1. Bulk publish/unpublish: headers → query params (DX-3233)
BulkPublishService.cs
skip_workflow_stage_checkandapprovalsare no longer set as headers.AddQueryResource("skip_workflow_stage_check", "true")andAddQueryResource("approvals", "true").Unit tests
QueryResourcesinstead ofHeaders; test names updated to "Query Parameter".QueryResourcesinstead ofHeaders.2. Integration tests – bulk operations (Contentstack015_BulkOperationTest.cs)
New/updated tests
skipWorkflowStage: trueandapprovals: true.skipWorkflowStage: trueandapprovals: true.ContentstackErrorExceptionand asserts non-success status and error message.Helper
bulk_test_content_typeand at least one entry exist so bulk tests can run in any order.Assertions and error handling
ContentstackErrorExceptionincludes HTTP status, ErrorCode, and API message.Assert.AreEqual(HttpStatusCode.OK, response.StatusCode)and descriptiveIsSuccessStatusCodemessages; catch blocks useFailWithError.System.Net,Contentstack.Management.Core.Exceptions.3. Release
Testing
Checklist