Skip to content

Commit 6a5e5d2

Browse files
authored
Merge pull request #277 from contentstack/claude/fix/DX-31579-branch-api-test-login
fix(branch): log in with EMAIL/PASSWORD and manage own environments in BranchAPITest (DX-31579)
2 parents 01ea18f + 289556e commit 6a5e5d2

2 files changed

Lines changed: 281 additions & 51 deletions

File tree

‎src/test/java/com/contentstack/cms/TestClient.java‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ public class TestClient {
3939
public static final String ENTRY_VARIANT_LOCALE =
4040
isBlank(env.get("entryVariantLocale")) ? "en-us" : env.get("entryVariantLocale").trim();
4141

42+
/** Login email for tests that log in with a real account (null when {@code EMAIL} is not set in {@code .env}). */
43+
public static final String EMAIL = env.get("EMAIL");
44+
45+
/** Login password for tests that log in with a real account (null when {@code PASSWORD} is not set in {@code .env}). */
46+
public static final String PASSWORD = env.get("PASSWORD");
47+
4248
/** {@code true} if {@code value} is null, empty, or whitespace-only. */
4349
private static boolean isBlank(String value) {
4450
return value == null || value.trim().isEmpty();
@@ -51,6 +57,11 @@ public static boolean isUsingDefaultStackCredentials() {
5157
return env.get("apiKey") == null || env.get("managementToken") == null;
5258
}
5359

60+
/** {@code true} when {@code apiKey} is set to a non-blank value in {@code .env}. */
61+
public static boolean isApiKeyConfigured() {
62+
return !isBlank(env.get("apiKey"));
63+
}
64+
5465
private static Contentstack instance;
5566
private static Stack stackInstance;
5667

0 commit comments

Comments
 (0)