From 10213a413ebce71b48068d7098b8dc5ce3c89f21 Mon Sep 17 00:00:00 2001 From: Jonathan Zollinger Date: Tue, 22 Jul 2025 22:28:16 -0600 Subject: [PATCH] refactor(test): check test_token is set in tests --- src/test/groovy/org/justserve/JustServeSpec.groovy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/test/groovy/org/justserve/JustServeSpec.groovy b/src/test/groovy/org/justserve/JustServeSpec.groovy index 3552b91..cc646a8 100644 --- a/src/test/groovy/org/justserve/JustServeSpec.groovy +++ b/src/test/groovy/org/justserve/JustServeSpec.groovy @@ -16,15 +16,20 @@ class JustServeSpec extends Specification { String justServeUrl, userEmail def setupSpec() { + if(System.getenv("TEST_TOKEN") == null) { + throw new IllegalStateException("TEST_TOKEN is NOT set. Define this variable for" + + "" + + " testing.") + } + if (null != System.getenv("JUSTSERVE_TOKEN")) { + throw new IllegalStateException("JUSTSERVE_TOKEN is set. Do not define this variable in testing.") + } justServeUrl = System.getenv("JUSTSERVE_URL") ?: "https://www.justserve.org" if (justServeUrl.toLowerCase().contains("dev")) { userEmail = "userc5f660c0-5c3a-42a8-bbe0-8dad54d00f42@fake.justserve.org" } else { userEmail = "jimmy@justserve.org" } - if (null != System.getenv("JUSTSERVE_TOKEN")) { - throw new IllegalStateException("JUSTSERVE_TOKEN is set. Do not define this variable in testing.") - } ctx = ApplicationContext.builder() .environments(Environment.CLI, Environment.TEST) .properties([