From 4046def91fe95b79307f32ce319668b8ed100a3f Mon Sep 17 00:00:00 2001 From: HMS-Victory <90852625+HMS-Victory@users.noreply.github.com> Date: Thu, 19 Mar 2026 13:41:14 -0600 Subject: [PATCH 1/3] test: test searchOrganization() query parser --- core/src/main/resources/schema.yml | 4 ++++ .../org/justserve/GraphQLClientSpec.groovy | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/core/src/main/resources/schema.yml b/core/src/main/resources/schema.yml index 5f21842..1767582 100644 --- a/core/src/main/resources/schema.yml +++ b/core/src/main/resources/schema.yml @@ -2111,8 +2111,12 @@ components: type: object properties: searchTerm: + minLength: 3 + maxLength: 100 + description: must not be null, and must be at least three characters long to avoid an exception type: string includeAll: + description: must not be null type: boolean GraphQLSetProjectLocationRequest: type: object diff --git a/core/src/test/groovy/org/justserve/GraphQLClientSpec.groovy b/core/src/test/groovy/org/justserve/GraphQLClientSpec.groovy index 1706118..3cc02c5 100644 --- a/core/src/test/groovy/org/justserve/GraphQLClientSpec.groovy +++ b/core/src/test/groovy/org/justserve/GraphQLClientSpec.groovy @@ -367,4 +367,23 @@ class GraphQLClientSpec extends Specification { noExceptionThrown() !response.hasErrors() } + + def "test searchOrganization parses the input correctly"(String searchTerm, Boolean includesAll) { + given: + + GraphQLSearchOrganizationVariables inputData = new GraphQLSearchOrganizationVariables() + .setSearchTerm(searchTerm) + .setIncludeAll(includesAll) + + when: + GraphQLResponse response = client.searchOrganization(inputData) + + then: + noExceptionThrown() + !response.hasErrors() + + where: + [includesAll, searchTerm] << [[true, false], ["the"]].combinations() + + } } From 8e34f930c0634afe53f7e682aa61c70bab63d1d6 Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Mon, 23 Mar 2026 13:08:52 -0600 Subject: [PATCH 2/3] fix(test): expect 201 or 200 when creating users Signed-off-by: jonathan zollinger --- .../groovy/org/justserve/JustServeSpec.groovy | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/core/src/test/groovy/org/justserve/JustServeSpec.groovy b/core/src/test/groovy/org/justserve/JustServeSpec.groovy index 8617b69..aec84e0 100644 --- a/core/src/test/groovy/org/justserve/JustServeSpec.groovy +++ b/core/src/test/groovy/org/justserve/JustServeSpec.groovy @@ -71,9 +71,7 @@ class JustServeSpec extends Specification { // } ctx = ApplicationContext.builder() .environments(Environment.CLI, Environment.TEST) - .properties([ - "justserve.token": System.getenv("TEST_TOKEN") - ]) + .properties(["justserve.token": System.getenv("TEST_TOKEN")]) .build() .start() noAuthCtx = ApplicationContext @@ -107,14 +105,13 @@ class JustServeSpec extends Specification { HttpResponse createUser(UserClient client = noAuthUserClient) { HttpResponse response = null def tries = 0 - while ((null == response || HttpStatus.OK != response.status()) && tries < 5) { + while ((null == response || ![HttpStatus.OK, HttpStatus.CREATED].contains(response.status())) && tries < 5) { try { // A new user is generated on each loop iteration to avoid collisions response = createUserFromFaker(client, new TestUser(new Faker(Locale.of("en-us")))) } catch (HttpClientResponseException ignored) { - tries++ - // This user likely already exists, so we'll loop and try a new one. } + tries++ } if (null == response) { throw new IllegalStateException("failed to create a test user after five attempts") @@ -161,7 +158,7 @@ class JustServeSpec extends Specification { .setContactPhone(faker.phoneNumber().phoneNumber()) .setDescription(faker.zelda().game()) .setLocationString(knownWorkingLocation) - .setLogo(getUploadedImageFileName()) + .setLogo(null) .setName(faker.zelda().character()) .set_public(null) .setUrl(getUniqueSlug()) @@ -196,9 +193,7 @@ class JustServeSpec extends Specification { * @return The file name of the uploaded image. */ String getUploadedImageFileName() { - HttpResponse profileImage = authImageClient.uploadImage( - new ImageUploadRequest(faker.image().base64JPG().split(",")[1], 256, 256, false, 0, 0) - ) + HttpResponse profileImage = authImageClient.uploadImage(new ImageUploadRequest(faker.image().base64JPG().split(",")[1], 256, 256, false, 0, 0)) return profileImage.body().displayFileName } @@ -209,7 +204,7 @@ class JustServeSpec extends Specification { String getUniqueSlug() { String urlSlug = null while (null == urlSlug) { - def potentialSlug = faker.word().noun() + def potentialSlug = faker.word().noun() + System.currentTimeMillis() def response = authDynamicRoutingClient.getOrgIdFromSlug(potentialSlug) if (response.status() == HttpStatus.NOT_FOUND) { urlSlug = potentialSlug From c563fa266ee613e1449509e95a6693441a37435c Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Mon, 23 Mar 2026 13:15:58 -0600 Subject: [PATCH 3/3] fix(test): set auth as "" in unauthenticated context Signed-off-by: jonathan zollinger --- core/src/test/groovy/org/justserve/JustServeSpec.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/test/groovy/org/justserve/JustServeSpec.groovy b/core/src/test/groovy/org/justserve/JustServeSpec.groovy index aec84e0..834f337 100644 --- a/core/src/test/groovy/org/justserve/JustServeSpec.groovy +++ b/core/src/test/groovy/org/justserve/JustServeSpec.groovy @@ -78,6 +78,7 @@ class JustServeSpec extends Specification { .builder() .environments(Environment.CLI, Environment.TEST) .environmentVariableExcludes("JUSTSERVE_TOKEN") + .properties(["justserve.token": ""]) .build() .start() noAuthUserClient = noAuthCtx.getBean(UserClient)