Test when scim is disabled
This commit is contained in:
parent
5d8c1e7e92
commit
d0772ee142
|
@ -5,6 +5,7 @@ import {
|
||||||
GoogleInnerConfig,
|
GoogleInnerConfig,
|
||||||
OIDCConfig,
|
OIDCConfig,
|
||||||
OIDCInnerConfig,
|
OIDCInnerConfig,
|
||||||
|
SCIMConfig,
|
||||||
SettingsConfig,
|
SettingsConfig,
|
||||||
SettingsInnerConfig,
|
SettingsInnerConfig,
|
||||||
SMTPConfig,
|
SMTPConfig,
|
||||||
|
@ -242,3 +243,7 @@ export async function getSMTPConfig(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getSCIMConfig(): Promise<SCIMConfig | undefined> {
|
||||||
|
return getConfig<SCIMConfig>(ConfigType.SCIM)
|
||||||
|
}
|
||||||
|
|
|
@ -107,6 +107,10 @@ export interface OIDCWellKnownConfig {
|
||||||
userinfo_endpoint: string
|
userinfo_endpoint: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SCIMConfig extends Config {
|
||||||
|
enabled: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export const isSettingsConfig = (config: Config): config is SettingsConfig =>
|
export const isSettingsConfig = (config: Config): config is SettingsConfig =>
|
||||||
config.type === ConfigType.SETTINGS
|
config.type === ConfigType.SETTINGS
|
||||||
|
|
||||||
|
@ -119,6 +123,9 @@ export const isGoogleConfig = (config: Config): config is GoogleConfig =>
|
||||||
export const isOIDCConfig = (config: Config): config is OIDCConfig =>
|
export const isOIDCConfig = (config: Config): config is OIDCConfig =>
|
||||||
config.type === ConfigType.OIDC
|
config.type === ConfigType.OIDC
|
||||||
|
|
||||||
|
export const isSCIMConfig = (config: Config): config is SCIMConfig =>
|
||||||
|
config.type === ConfigType.SCIM
|
||||||
|
|
||||||
export enum ConfigType {
|
export enum ConfigType {
|
||||||
SETTINGS = "settings",
|
SETTINGS = "settings",
|
||||||
ACCOUNT = "account",
|
ACCOUNT = "account",
|
||||||
|
|
|
@ -41,6 +41,17 @@ const unauthorisedTests = (
|
||||||
status: 400,
|
status: 400,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("cannot be called when feature is enabled but the config disabled", async () => {
|
||||||
|
const response = await fn(...Array(fn.length - 1).fill({}), {
|
||||||
|
expect: 400,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(response).toEqual({
|
||||||
|
message: "SCIM is not enabled",
|
||||||
|
status: 400,
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +73,7 @@ describe("scim", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("/api/global/scim/v2/users", () => {
|
describe("/api/global/scim/v2/users", () => {
|
||||||
describe("GET /api/global/scim/v2/users", () => {
|
describe.only("GET /api/global/scim/v2/users", () => {
|
||||||
const getScimUsers = config.api.scimUsersAPI.get
|
const getScimUsers = config.api.scimUsersAPI.get
|
||||||
|
|
||||||
unauthorisedTests(getScimUsers)
|
unauthorisedTests(getScimUsers)
|
||||||
|
|
Loading…
Reference in New Issue