Revert TestConfiguration changes

This commit is contained in:
Adria Navarro 2023-09-13 16:33:04 +02:00
parent dc29ebfe27
commit d1e1ad4930
1 changed files with 11 additions and 7 deletions

View File

@ -535,7 +535,7 @@ class TestConfiguration {
{ skipReassigning } = { skipReassigning: false } { skipReassigning } = { skipReassigning: false }
): Promise<Table> { ): Promise<Table> {
config = config || basicTable() config = config || basicTable()
const response = await this.api.table.create(config) const response = await this._req(config, null, controllers.table.save)
if (!skipReassigning) { if (!skipReassigning) {
this.table = response this.table = response
} }
@ -589,7 +589,7 @@ class TestConfiguration {
} }
} }
const linkedTable = await this.api.table.create(tableConfig) const linkedTable = await this.createTable(tableConfig)
return linkedTable return linkedTable
} }
@ -609,7 +609,7 @@ class TestConfiguration {
} }
const tableId = (config && config.tableId) || this.table._id const tableId = (config && config.tableId) || this.table._id
config = config || basicRow(tableId!) config = config || basicRow(tableId!)
return this.api.row.save(tableId!, config) return this._req(config, { tableId }, controllers.row.save)
} }
async getRow(tableId: string, rowId: string): Promise<Row> { async getRow(tableId: string, rowId: string): Promise<Row> {
@ -715,14 +715,18 @@ class TestConfiguration {
datasource: Datasource datasource: Datasource
}): Promise<Datasource> { }): Promise<Datasource> {
config = config || basicDatasource() config = config || basicDatasource()
const response = await this.api.datasource.create({ ...config.datasource }) const response = await this._req(config, null, controllers.datasource.save)
this.datasource = response this.datasource = response.datasource
return this.datasource! return this.datasource!
} }
async updateDatasource(datasource: Datasource): Promise<Datasource> { async updateDatasource(datasource: Datasource): Promise<Datasource> {
const response = await this.api.datasource.update(datasource) const response = await this._req(
this.datasource = response datasource,
{ datasourceId: datasource._id },
controllers.datasource.update
)
this.datasource = response.datasource
return this.datasource! return this.datasource!
} }