Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@ tasks.withType<ProcessResources> {
}
}

tasks.withType<Test> {
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
// Exclude EmailParserSpec until we can provide test .eml files without PII data
exclude("**/EmailParserSpec.class")
}

//tasks.withType<Test> {
// testLogging {
// events("passed", "skipped", "failed")
// showStandardStreams = true
// exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
// }
//// Exclude EmailParserSpec until we can provide test .eml files without PII data
// exclude("**/EmailParserSpec.class")
//}

micronaut {
testRuntime("spock2")
Expand Down
64 changes: 64 additions & 0 deletions src/main/resources/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,41 @@ paths:
description: Bad Request
'500':
description: Internal Server Error
/api/v1/users/{userId}/bounded:
get:
operationId: getAllInfo
tags:
- User
parameters:
- name: userId
in: path
required: true
schema:
type: string
format: uuid
- name: showLeads
in: query
schema:
type: boolean
default: true
- name: showFull
in: query
schema:
type: boolean
default: true
- name: levels
in: query
schema:
type: integer
format: int32
default: 1
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/UserResultBounded"
/api/v1/users/securitycontext/bearer:
get:
description: "Retrieves the admin context for a given user (ie org ID's, church unit id's, role levels, etc). if no user is provided, it will return the context for the currently authenticated user"
Expand Down Expand Up @@ -659,6 +694,35 @@ components:
type: string
description: "The unique ID of the user."
additionalProperties: false
UserResultBounded:
type: object
properties:
id:
type: string
format: uuid
nullable: true
firstName:
type: string
nullable: true
lastName:
type: string
nullable: true
role:
$ref: '#/components/schemas/Role'
isLead:
type: boolean
email:
type: string
nullable: true
phone:
type: string
nullable: true
keywords:
type: string
nullable: true
isActive:
type: boolean
additionalProperties: false
UserSearchRequest:
description: |
search query used in a few different endpoints
Expand Down
30 changes: 26 additions & 4 deletions src/test/groovy/org/justserve/client/UserClientSpec.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package org.justserve.client

import io.micronaut.http.HttpResponse
import io.micronaut.http.HttpStatus
import io.micronaut.http.client.exceptions.HttpClientResponseException
import io.micronaut.http.exceptions.HttpException
import net.datafaker.Faker
import org.apache.commons.lang3.RandomStringUtils
import org.justserve.JustServeSpec
import org.justserve.TestUser
import org.justserve.model.UserHashRequestByEmail
import org.justserve.model.UserResultBounded

import static io.micronaut.http.HttpStatus.UNAUTHORIZED

Expand All @@ -20,7 +24,7 @@ class UserClientSpec extends JustServeSpec {
client.createUser(
user.firstName,
user.lastName,
RandomStringUtils.insecure().nextAlphanumeric(20)+ "@fake.com",
RandomStringUtils.insecure().nextAlphanumeric(20) + "@fake.com",
user.password,
user.zipcode,
user.locale,
Expand Down Expand Up @@ -68,8 +72,26 @@ class UserClientSpec extends JustServeSpec {
exception.status == expectedError

where:
expectedError | client | _
null | userClient | _
UNAUTHORIZED | noAuthUserClient | _
expectedError | client | _
null | userClient | _
UNAUTHORIZED | noAuthUserClient | _
}

def "Should be able to get details for a specific user without facing errors"(UserClient client, HttpStatus expectedError) {
when:
HttpResponse<UserResultBounded> response = client.getAllInfo(readOnlyUser.uuid, true, true, 1)

then:
if (!expectedError) {
response.body() != null
return
}
def exception = thrown(HttpClientResponseException)
exception.status == expectedError

where:
expectedError | client | _
null | userClient | _
UNAUTHORIZED | noAuthUserClient | _
}
}
121 changes: 0 additions & 121 deletions src/test/groovy/org/justserve/util/EmailParserSpec.groovy

This file was deleted.

Loading