diff --git a/qa-core/src/config/public-api/TestConfiguration/PublicAPIClient.ts b/qa-core/src/config/public-api/TestConfiguration/PublicAPIClient.ts index 14bc93ef06..0cff3eb840 100644 --- a/qa-core/src/config/public-api/TestConfiguration/PublicAPIClient.ts +++ b/qa-core/src/config/public-api/TestConfiguration/PublicAPIClient.ts @@ -23,6 +23,7 @@ class PublicAPIClient { ) } this.host = `${env.BUDIBASE_HOST}/api/public/v1` + this.appId = appId } @@ -32,6 +33,8 @@ class PublicAPIClient { setApiKey(apiKey: string) { this.apiKey = apiKey + process.env.BUDIBASE_PUBLIC_API_KEY = apiKey + this.host = `${env.BUDIBASE_HOST}/api/public/v1` } apiCall = diff --git a/qa-core/src/config/public-api/TestConfiguration/auth.ts b/qa-core/src/config/public-api/TestConfiguration/auth.ts index 663b39e5e9..b832d6f7f9 100644 --- a/qa-core/src/config/public-api/TestConfiguration/auth.ts +++ b/qa-core/src/config/public-api/TestConfiguration/auth.ts @@ -1,16 +1,16 @@ import { Response } from "node-fetch" -import PublicAPIClient from "./PublicAPIClient" +import AccountsAPIClient from "./accountsAPIClient" import { ApiKeyResponse } from "../fixtures/types/apiKeyResponse" export default class AuthApi { - api: PublicAPIClient + api: AccountsAPIClient - constructor(apiClient: PublicAPIClient) { + constructor(apiClient: AccountsAPIClient) { this.api = apiClient } async loginAsAdmin(): Promise<[Response, any]> { - const response = await this.api.post(`/global/auth/default/login`, { + const response = await this.api.post(`/auth/login`, { body: { username: process.env.BB_ADMIN_USER_EMAIL, password: process.env.BB_ADMIN_USER_PASSWORD, @@ -22,7 +22,7 @@ export default class AuthApi { } async login(email: String, password: String): Promise<[Response, any]> { - const response = await this.api.post(`/global/auth/default/login`, { + const response = await this.api.post(`/auth/login`, { body: { username: email, password: password, diff --git a/qa-core/src/tests/public-api/users/users.spec.ts b/qa-core/src/tests/public-api/users/users.spec.ts index edc675fd81..7f53a95057 100644 --- a/qa-core/src/tests/public-api/users/users.spec.ts +++ b/qa-core/src/tests/public-api/users/users.spec.ts @@ -11,6 +11,8 @@ describe("Public API - /users endpoints", () => { beforeAll(async () => { await config.beforeAll() + await config.setupAccountAndTenant() + await config.setApiKey() const [_, user] = await config.users.seed() config.context = user })