28 lines
842 B
JavaScript
28 lines
842 B
JavaScript
const models = require('vn-loopback/server/server').models;
|
|
|
|
fdescribe('Mdb upload()', () => {
|
|
it(`should return an error for a user without enough privileges`, async() => {
|
|
const tx = await models.MdbVersion.beginTransaction({});
|
|
|
|
let error;
|
|
|
|
try {
|
|
const options = {transaction: tx};
|
|
const currentUserId = 1101;
|
|
const appName = 'tpv';
|
|
const newVersion = '123';
|
|
const branch = 'test';
|
|
const ctx = {req: {accessToken: {userId: currentUserId}}};
|
|
|
|
await models.MdbVersion.upload(ctx, appName, newVersion, branch, options);
|
|
|
|
await tx.rollback();
|
|
} catch (e) {
|
|
await tx.rollback();
|
|
error = e;
|
|
}
|
|
|
|
expect(error.message).toEqual(`You don't have enough privileges`);
|
|
});
|
|
});
|