diff --git a/src/test/java/com/contentstack/cms/TestClient.java b/src/test/java/com/contentstack/cms/TestClient.java index 06239356..73a743f0 100644 --- a/src/test/java/com/contentstack/cms/TestClient.java +++ b/src/test/java/com/contentstack/cms/TestClient.java @@ -46,6 +46,9 @@ public class TestClient { /** Login password for tests that log in with a real account (null when {@code PASSWORD} is not set in {@code .env}). */ public static final String PASSWORD = env.get("PASSWORD"); + /** MFA secret for accounts with two-factor on (null when {@code MFA_SECRET} is not set in {@code .env}). */ + public static final String MFA_SECRET = env.get("MFA_SECRET"); + /** {@code true} if {@code value} is null, empty, or whitespace-only. */ private static boolean isBlank(String value) { return value == null || value.trim().isEmpty(); diff --git a/src/test/java/com/contentstack/cms/stack/BranchAPITest.java b/src/test/java/com/contentstack/cms/stack/BranchAPITest.java index 6da75aab..6a370658 100644 --- a/src/test/java/com/contentstack/cms/stack/BranchAPITest.java +++ b/src/test/java/com/contentstack/cms/stack/BranchAPITest.java @@ -35,6 +35,9 @@ * Needs {@code EMAIL}, {@code PASSWORD} and {@code apiKey} in {@code .env} (or the environment). When any of * them is missing the whole class is skipped with an "not run" message, which is not a pass. *
+ * If the account has two-factor on, also set {@code MFA_SECRET}: the login then passes it as {@code mfaSecret} + * and the SDK generates the one-time code. Without it the plain email and password login is used. + *
* Branch creation is asynchronous: after each successful create the test polls the branch until fetch
* succeeds. A rejected create leaves no branch, which the API reports as 422 with error_code 905 (the same
* answer as a branch that does not exist).
@@ -103,7 +106,15 @@ static void setup() throws Exception {
Assumptions.assumeTrue(apiKeyConfigured, "not run: apiKey is not set in .env");
client = new Contentstack.Builder().setHost(TestClient.DEV_HOST).build();
- Response