chore(api v1): Deprecate datasource/save and datasource/get endpoints (#23678)

This commit is contained in:
Jack Fragassi
2023-04-18 17:51:24 -07:00
committed by GitHub
parent 818a1d482b
commit 44557f5a23
23 changed files with 242 additions and 70 deletions

View File

@@ -69,9 +69,20 @@ const createProps = (overrides: JsonObject = {}) => ({
});
async function openAndSaveChanges(datasource: any) {
fetchMock.post('glob:*/datasource/save/', datasource, {
overwriteRoutes: true,
});
fetchMock.put(
'glob:*/api/v1/dataset/*',
{},
{
overwriteRoutes: true,
},
);
fetchMock.get(
'glob:*/api/v1/dataset/*',
{ result: datasource },
{
overwriteRoutes: true,
},
);
userEvent.click(screen.getByTestId('datasource-menu-trigger'));
userEvent.click(await screen.findByTestId('edit-dataset'));
userEvent.click(await screen.findByTestId('datasource-modal-save'));
@@ -154,7 +165,7 @@ test('Should show SQL Lab for sql_lab role', async () => {
test('Click on Swap dataset option', async () => {
const props = createProps();
SupersetClientGet.mockImplementation(
SupersetClientGet.mockImplementationOnce(
async ({ endpoint }: { endpoint: string }) => {
if (endpoint.includes('_info')) {
return {
@@ -182,7 +193,7 @@ test('Click on Swap dataset option', async () => {
test('Click on Edit dataset', async () => {
const props = createProps();
SupersetClientGet.mockImplementation(
SupersetClientGet.mockImplementationOnce(
async () => ({ json: { result: [] } } as any),
);
render(<DatasourceControl {...props} />, {
@@ -206,7 +217,7 @@ test('Edit dataset should be disabled when user is not admin', async () => {
// @ts-expect-error
props.user.roles = {};
props.datasource.owners = [];
SupersetClientGet.mockImplementation(
SupersetClientGet.mockImplementationOnce(
async () => ({ json: { result: [] } } as any),
);