From b31ea486f3b53a5fcf7846a78959f2fdd5f4c1a2 Mon Sep 17 00:00:00 2001 From: Tristan Garwood Date: Mon, 30 Oct 2023 10:32:59 -0400 Subject: [PATCH] Add to pact readme. --- pact4s/README.md | 8 ++++++++ .../dsde/workbench/sam/MockTestSupport.scala | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pact4s/README.md b/pact4s/README.md index ba484140b..3d3b7f3dd 100644 --- a/pact4s/README.md +++ b/pact4s/README.md @@ -10,6 +10,8 @@ The credentials for authenticating with the Pact Broker can be found here: On the command line, you can try the following: ```shell +source env/local.env +source src/main/resources/rendered/secrets.env export PACT_BROKER_URL="https://pact-broker.dsp-eng-tools.broadinstitute.org/" export PACT_BROKER_USERNAME=$(vault read -field=basic_auth_read_only_username secret/dsp/pact-broker/users/read-only) export PACT_BROKER_PASSWORD=$(vault read -field=basic_auth_read_only_password secret/dsp/pact-broker/users/read-only) @@ -21,6 +23,12 @@ In IntelliJ, you can create a Run Configuration for `SamProviderSpec.scala` and * `PACT_BROKER_USERNAME` * `PACT_BROKER_USERNAME` +Or you can run the following command from the root of the project: + +```shell +sbt "set scalafmtOnCompile := false" "project pact4s" "testOnly *SamProviderSpec" +``` + ## References * https://broadworkbench.atlassian.net/wiki/spaces/IRT/pages/2660368406/Getting+Started+with+Pact+Contract+Testing * https://broadworkbench.atlassian.net/wiki/spaces/IRT/pages/2681143308/Pact+Broker+Infrastructure diff --git a/pact4s/src/test/scala/org/broadinstitute/dsde/workbench/sam/MockTestSupport.scala b/pact4s/src/test/scala/org/broadinstitute/dsde/workbench/sam/MockTestSupport.scala index c10db52af..b530fcaa8 100644 --- a/pact4s/src/test/scala/org/broadinstitute/dsde/workbench/sam/MockTestSupport.scala +++ b/pact4s/src/test/scala/org/broadinstitute/dsde/workbench/sam/MockTestSupport.scala @@ -202,7 +202,7 @@ object MockTestSupport extends MockTestSupport { // Override the withUserAllowInactive in MockSamUserDirectives to include // support for user status info request with or without access token - override def withUserAllowInactive(samRequestContext: SamRequestContext): Directive1[SamUser] = { + override def withUserAllowInactive(samRequestContext: SamRequestContext): Directive1[SamUser] = extractRequest.flatMap { request => // Use an extractRequest Directive to capture the headers for debugging purpose val headers = request.headers @@ -221,9 +221,9 @@ object MockTestSupport extends MockTestSupport { complete(StatusCodes.Unauthorized) } } - } - override val adminConfig: AdminConfig = AdminConfig(superAdminsGroup = WorkbenchEmail(""), allowedEmailDomains = Set.empty, serviceAccountAdmins = Set.empty) + override val adminConfig: AdminConfig = + AdminConfig(superAdminsGroup = WorkbenchEmail(""), allowedEmailDomains = Set.empty, serviceAccountAdmins = Set.empty) override def asAdminServiceUser: Directive0 = Directive.Empty }