From c68dd8cf7adc1bad99c905907d3c7b88643db01a Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 12 Nov 2026 13:02:02 +0530 Subject: [PATCH 1/2] chore(release): set v1.2.0 release date to 2026-11-12 (DX-31560) The v1.2.0 changelog entry carried the date the feature merged (28 Oct), which now sits above a Snyk release dated 2 Nov. Set the date to the release date. No version change: v1.2.0 is already the version in the repo and is not yet released. Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9b6742..2d8b752 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [v1.2.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.2.0)(2026-10-28) +## [v1.2.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.2.0)(2026-11-12) - **New** - **Branch create: optional environment list**: `BranchModel.PublishConfig` (`BranchPublishConfigModel`, with `Environments` as a list of environment names, not UIDs) lets `Branch.Create` / `CreateAsync` clone only the listed environments. `[]` clones none; leaving `PublishConfig` unset clones all environments, as before. The list is sent unchanged; an unknown name or a mix rejects with the API's 422 error (`ContentstackErrorException`, message, error code and errors unchanged) and no branch is created. From 8803153283edba06aa4d8083635777746871291a Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 12 Nov 2026 13:10:01 +0530 Subject: [PATCH 2/2] test(branch): create the environments the live branch test uses (DX-31560) Contentstack005_BranchTest hard-coded the environment names development and staging, which do not exist on the stack the integration suite creates, so Test026 (create with two environment names) failed with a 422 "Environment 'development' was not found". Create two uniquely named environments in ClassInitialize and delete them in ClassCleanup, and describe it in the v1.2.0 changelog test notes. Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 2 +- .../Contentstack005_BranchTest.cs | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d8b752..0abd0ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - **Branch fetch**: a fetched `BranchModel` carries `PublishConfig.Environments` as the API returns it; it is `null` when the API omits it. - **Test** - Unit tests for the branch create body with two names, `[]` and unset (through `Create` and `CreateAsync`), a mocked 422 rejection, and fetched branch deserialization. - - Integration tests for create with two names, `[]`, an unknown name and a mix (written; not run in this change). + - Integration tests for create with two names, `[]`, an unknown name and a mix. The test class now creates two uniquely named environments on the stack and deletes them afterwards, because the `development` and `staging` names it used before do not exist on the stack the suite creates, so the two-name case failed with a 422. Run live against the NA prod API, the four environment-list cases pass. ## [v1.1.1](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.1.1)(2026-07-30) diff --git a/Contentstack.Management.Core.Tests/IntegrationTest/Contentstack005_BranchTest.cs b/Contentstack.Management.Core.Tests/IntegrationTest/Contentstack005_BranchTest.cs index d55f1c9..5ba0e99 100644 --- a/Contentstack.Management.Core.Tests/IntegrationTest/Contentstack005_BranchTest.cs +++ b/Contentstack.Management.Core.Tests/IntegrationTest/Contentstack005_BranchTest.cs @@ -29,8 +29,10 @@ public class Contentstack005_BranchTest // publish_config.environments: names (not UIDs) that must exist on the test stack. // Set these to two real environment names on the stack before running the live suite. - private const string EnvironmentOne = "development"; - private const string EnvironmentTwo = "staging"; + private static readonly string EnvironmentOne = "dotnet_brenv_" + Guid.NewGuid().ToString("N").Substring(0,6); + private static string _envOneUid; + private static readonly string EnvironmentTwo = "dotnet_brenv_" + Guid.NewGuid().ToString("N").Substring(0,6); + private static string _envTwoUid; private const string UnknownEnvironment = "dotnet_no_env_99999"; private const string EnvTwoBranchUid = "dotnet_env_two"; // max 15 chars, alphanumeric+underscore private const string EnvNoneBranchUid = "dotnet_env_none"; // max 15 chars, alphanumeric+underscore @@ -44,6 +46,9 @@ public static void ClassInitialize(TestContext context) StackResponse response = StackResponse.getStack(_client.serializer); _stack = _client.Stack(response.Stack.APIKey); + _envOneUid = CreateTestEnvironment(EnvironmentOne); + _envTwoUid = CreateTestEnvironment(EnvironmentTwo); + // Best-effort cleanup of any branches left over from a previous test run TryDeleteBranch(TestBranchUid); TryDeleteBranch(TestBranchUidAsync); @@ -63,10 +68,24 @@ public static void ClassCleanup() TryDeleteBranch(EnvUnknownBranchUid); TryDeleteBranch(EnvMixBranchUid); + try { if (_envOneUid != null) _stack.Environment(_envOneUid).Delete(); } catch { } + try { if (_envTwoUid != null) _stack.Environment(_envTwoUid).Delete(); } catch { } + try { _client?.Logout(); } catch { } _client = null; } + private static string CreateTestEnvironment(string name) + { + var model = new EnvironmentModel + { + Name = name, + Urls = new List { new LocalesUrl { Locale = "en-us", Url = "https://example.com" } } + }; + ContentstackResponse r = _stack.Environment().Create(model); + return r.IsSuccessStatusCode ? r.OpenJsonObjectResponse()["environment"]?["uid"]?.ToString() : null; + } + private static void TryDeleteBranch(string uid) { if (string.IsNullOrEmpty(uid)) return;