Skip to content

Commit 76c9879

Browse files
committed
delete EXCHANGE_OAUTH_ENABLED from conf. Add comment on UT
Signed-off-by: wenyang-cao <wenyang.cao@ibm.com>
1 parent 8dfc804 commit 76c9879

6 files changed

Lines changed: 25 additions & 6 deletions

File tree

src/main/resources/exchange.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ api {
5353
tls.password = ${?EXCHANGE_TLS_PASSWORD}
5454
tls.truststore = ${?api.tls.truststore}
5555
tls.truststore = ${?EXCHANGE_TLS_TRUSTSTORE}
56-
57-
oauth.enabled = ${?EXCHANGE_OAUTH_ENABLED}
5856
}
5957

6058
exchange-db-connection {

src/main/resources/reference.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ api {
159159
tls.password = null # Truststore's password
160160
tls.truststore = null # Absolute path and name of your pkcs12 (.p12) truststore that contains your tls certificate and private key
161161

162-
oauth.enabled = false
163-
164162
cache {
165163
authDbTimeoutSeconds = 15 # Timeout for db access for critical auth info when cache missing
166164
IAMusersMaxSize = 300 # The users that are backed by IAM users

src/test/scala/org/openhorizon/exchangeapi/route/user/TestPatchUserRoute.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ class TestPatchUserRoute extends AnyFunSuite with BeforeAndAfterAll with BeforeA
206206
assert(dbUser.modified_by === user.modified_by)
207207
}
208208

209+
// Note:
210+
// If the environment variable EXCHANGE_OAUTH_USER_INFO_URL is set (via `export`),
211+
// the updateConfig(...) call cannot override its value.
212+
// This might cause tests that rely on non-OAuth mode to fail.
213+
// To ensure consistent behavior, unset the variable before running tests with:
214+
// unset EXCHANGE_OAUTH_USER_INFO_URL
209215
def updateConfig(key: String, value: String): Unit = {
210216
val configInput = AdminConfigRequest(key, value)
211217
val response = Http(BASEURL+"/admin/config").postData(Serialization.write(configInput)).method("PUT").headers(CONTENT).headers(ACCEPT).headers(ROOTAUTH).asString

src/test/scala/org/openhorizon/exchangeapi/route/user/TestPostChangeUserPasswordRoute.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ class TestPostChangeUserPasswordRoute extends AnyFunSuite with BeforeAndAfterAll
190190
info("Body: " + response.body)
191191
}
192192

193+
// Note:
194+
// If the environment variable EXCHANGE_OAUTH_USER_INFO_URL is set (via `export`),
195+
// the updateConfig(...) call cannot override its value.
196+
// This might cause tests that rely on non-OAuth mode to fail.
197+
// To ensure consistent behavior, unset the variable before running tests with:
198+
// unset EXCHANGE_OAUTH_USER_INFO_URL
193199
def updateConfig(key: String, value: String): Unit = {
194200
val configInput = AdminConfigRequest(key, value)
195201
val response = Http(BASEURL+"/admin/config").postData(Serialization.write(configInput)).method("PUT").headers(CONTENT).headers(ACCEPT).headers(ROOTAUTH).asString

src/test/scala/org/openhorizon/exchangeapi/route/user/TestPostUserRoute.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ class TestPostUserRoute extends AnyFunSuite with BeforeAndAfterAll with BeforeAn
165165
info("Code: " + response.code)
166166
info("Body: " + response.body)
167167
}
168-
168+
// Note:
169+
// If the environment variable EXCHANGE_OAUTH_USER_INFO_URL is set (via `export`),
170+
// the updateConfig(...) call cannot override its value.
171+
// This might cause tests that rely on non-OAuth mode to fail.
172+
// To ensure consistent behavior, unset the variable before running tests with:
173+
// unset EXCHANGE_OAUTH_USER_INFO_URL
169174
def updateConfig(key: String, value: String): Unit = {
170175
val configInput = AdminConfigRequest(key, value)
171176
val response = Http(BASEURL+"/admin/config").postData(Serialization.write(configInput)).method("PUT").headers(CONTENT).headers(ACCEPT).headers(ROOTAUTH).asString

src/test/scala/org/openhorizon/exchangeapi/route/user/TestPutUserRoute.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ class TestPutUserRoute extends AnyFunSuite with BeforeAndAfterAll with BeforeAnd
187187
info("Code: " + response.code)
188188
info("Body: " + response.body)
189189
}
190-
190+
191+
// Note:
192+
// If the environment variable EXCHANGE_OAUTH_USER_INFO_URL is set (via `export`),
193+
// the updateConfig(...) call cannot override its value.
194+
// This might cause tests that rely on non-OAuth mode to fail.
195+
// To ensure consistent behavior, unset the variable before running tests with:
196+
// unset EXCHANGE_OAUTH_USER_INFO_URL
191197
def updateConfig(key: String, value: String): Unit = {
192198
val configInput = AdminConfigRequest(key, value)
193199
val response = Http(BASEURL+"/admin/config").postData(Serialization.write(configInput)).method("PUT").headers(CONTENT).headers(ACCEPT).headers(ROOTAUTH).asString

0 commit comments

Comments
 (0)