Use docker utils helpers

This commit is contained in:
Adria Navarro 2023-09-04 19:05:04 +02:00
parent 8931309669
commit e4479ee522
1 changed files with 19 additions and 1 deletions

View File

@ -1,4 +1,9 @@
import { CreateDatasourceRequest, Datasource } from "@budibase/types" import {
CreateDatasourceRequest,
Datasource,
VerifyDatasourceRequest,
VerifyDatasourceResponse,
} from "@budibase/types"
import TestConfiguration from "../TestConfiguration" import TestConfiguration from "../TestConfiguration"
import { TestAPI } from "./base" import { TestAPI } from "./base"
@ -23,4 +28,17 @@ export class DatasourceAPI extends TestAPI {
.expect(expectStatus) .expect(expectStatus)
return result.body.datasource as Datasource return result.body.datasource as Datasource
} }
verify = async (
data: VerifyDatasourceRequest,
{ expectStatus } = { expectStatus: 200 }
) => {
const result = await this.request
.post(`/api/datasources/verify`)
.send(data)
.set(this.config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(expectStatus)
return result
}
} }