mirror of
https://github.com/inventree/InvenTree.git
synced 2025-11-14 11:56:44 +00:00
Supplier Mixin (#9761)
* commit initial draft for supplier import * complete import wizard * allow importing only mp and sp * improved sample supplier plugin * add docs * add tests * bump api version * fix schema docu * fix issues from code review * commit unstaged changes * fix test * refactor part parameter bulk creation * try to fix test * fix tests * fix test for mysql * fix test * support multiple suppliers by a single plugin * hide import button if there is no supplier import plugin * make form submitable via enter * add pui test * try to prevent race condition * refactor api calls in pui tests * try to fix tests again? * fix tests * trigger: ci * update changelog * fix api_version * fix style * Update CHANGELOG.md Co-authored-by: Matthias Mair <code@mjmair.com> * add user docs --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
@@ -1,54 +1,48 @@
|
||||
import { expect } from 'playwright/test';
|
||||
|
||||
import { apiUrl } from './defaults';
|
||||
import { createApi } from './api';
|
||||
|
||||
/*
|
||||
* Set the value of a global setting in the database
|
||||
*/
|
||||
export const setSettingState = async ({
|
||||
request,
|
||||
setting,
|
||||
value
|
||||
value,
|
||||
type = 'global',
|
||||
plugin
|
||||
}: {
|
||||
request: any;
|
||||
setting: string;
|
||||
value: any;
|
||||
type?: 'global' | 'plugin';
|
||||
plugin?: string;
|
||||
}) => {
|
||||
const url = new URL(`settings/global/${setting}/`, apiUrl).toString();
|
||||
|
||||
const response = await request.patch(url, {
|
||||
const api = await createApi();
|
||||
const url =
|
||||
type === 'global'
|
||||
? `settings/global/${setting}/`
|
||||
: `plugins/${plugin}/settings/${setting}/`;
|
||||
const response = await api.patch(url, {
|
||||
data: {
|
||||
value: value
|
||||
},
|
||||
headers: {
|
||||
// Basic username: password authorization
|
||||
Authorization: `Basic ${btoa('admin:inventree')}`
|
||||
}
|
||||
});
|
||||
|
||||
expect(await response.status()).toBe(200);
|
||||
expect(response.status()).toBe(200);
|
||||
};
|
||||
|
||||
export const setPluginState = async ({
|
||||
request,
|
||||
plugin,
|
||||
state
|
||||
}: {
|
||||
request: any;
|
||||
plugin: string;
|
||||
state: boolean;
|
||||
}) => {
|
||||
const url = new URL(`plugins/${plugin}/activate/`, apiUrl).toString();
|
||||
|
||||
const response = await request.patch(url, {
|
||||
const api = await createApi();
|
||||
const response = await api.patch(`plugins/${plugin}/activate/`, {
|
||||
data: {
|
||||
active: state
|
||||
},
|
||||
headers: {
|
||||
// Basic username: password authorization
|
||||
Authorization: `Basic ${btoa('admin:inventree')}`
|
||||
}
|
||||
});
|
||||
|
||||
expect(await response.status()).toBe(200);
|
||||
expect(response.status()).toBe(200);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user