Make tests run again
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ exports = module.exports = {
|
||||
CLOUDRON_DEFAULT_AVATAR_FILE: path.join(__dirname + '/../assets/avatar.png'),
|
||||
INFRA_VERSION_FILE: path.join(baseDir(), 'platformdata/INFRA_VERSION'),
|
||||
CRON_SEED_FILE: path.join(baseDir(), 'platformdata/CRON_SEED'),
|
||||
DASHBOARD_DIR: constants.TEST ? path.join(__dirname, '../../dashboard/src') : path.join(baseDir(), 'box/dashboard/dist'),
|
||||
DASHBOARD_DIR: constants.TEST ? path.join(__dirname, '../dashboard/src') : path.join(baseDir(), 'box/dashboard/dist'),
|
||||
|
||||
PROVIDER_FILE: '/etc/cloudron/PROVIDER',
|
||||
SETUP_TOKEN_FILE: '/etc/cloudron/SETUP_TOKEN',
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('Volumes API', function () {
|
||||
it('cannot create volume with bad name', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/volumes`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ name: 'music#/ ', hostPath: '/media/cloudron-test-music', mountType: 'filesystem', mountOptions: {} })
|
||||
.send({ name: 'music#/ ', mountType: 'filesystem', mountOptions: { hostPath: '/media/cloudron-test-music' } })
|
||||
.ok(() => true);
|
||||
expect(response.statusCode).to.equal(400);
|
||||
});
|
||||
@@ -27,7 +27,7 @@ describe('Volumes API', function () {
|
||||
it('cannot create volume with bad path', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/volumes`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ name: 'music', hostPath: '/tmp/music', mountType: 'filesystem', mountOptions: {} })
|
||||
.send({ name: 'music', mountType: 'filesystem', mountOptions: { hostPath: '/tmp/music' } })
|
||||
.ok(() => true);
|
||||
expect(response.statusCode).to.equal(400);
|
||||
});
|
||||
@@ -35,7 +35,7 @@ describe('Volumes API', function () {
|
||||
it('can create volume', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/volumes`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ name: 'music', hostPath: '/media/cloudron-test-music', mountType: 'filesystem', mountOptions: {} })
|
||||
.send({ name: 'music', mountType: 'filesystem', mountOptions: { hostPath: '/media/cloudron-test-music' } })
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.status).to.equal(201);
|
||||
|
||||
@@ -25,6 +25,7 @@ scripts=("${SOURCE_DIR}/src/scripts/clearvolume.sh" \
|
||||
"${SOURCE_DIR}/src/scripts/rmmailbox.sh" \
|
||||
"${SOURCE_DIR}/src/scripts/setblocklist.sh" \
|
||||
"${SOURCE_DIR}/src/scripts/setldapallowlist.sh" \
|
||||
"${SOURCE_DIR}/src/scripts/hdparm.sh" \
|
||||
"${SOURCE_DIR}/src/scripts/configurelogrotate.sh")
|
||||
|
||||
for script in "${scripts[@]}"; do
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('Eventlog', function () {
|
||||
it('cleans up', async function () {
|
||||
await eventlog._clear();
|
||||
|
||||
for (const e of [ 'persistent.event', 'transient.event', 'anothertransient.event', 'anotherpersistent.event' ]) {
|
||||
for (const e of [ eventlog.ACTION_USER_LOGIN, eventlog.ACTION_USER_LOGIN_GHOST, eventlog.ACTION_USER_LOGOUT, eventlog.ACTION_USER_LOGIN ]) {
|
||||
const eventId = await eventlog.add(e, { ip: '1.2.3.4' }, { appId: 'thatapp' });
|
||||
|
||||
await notifications._add(eventId, 'title', 'some message');
|
||||
@@ -119,14 +119,14 @@ describe('Eventlog', function () {
|
||||
|
||||
await delay(3000);
|
||||
|
||||
const id = await eventlog.add('some.event', { ip: '1.2.3.4' }, { appId: 'thatapp' });
|
||||
const id = await eventlog.add(eventlog.ACTION_USER_LOGIN, { ip: '1.2.3.4' }, { appId: 'thatapp' });
|
||||
|
||||
await eventlog.cleanup({ creationTime: new Date(Date.now() - 1000) }); // 1 second ago
|
||||
let results = await eventlog.listPaged([], null, 1, 100);
|
||||
expect(results.length).to.be(1);
|
||||
|
||||
expect(results[0].id).to.be(id);
|
||||
expect(results[0].action).to.be('some.event');
|
||||
expect(results[0].action).to.be(eventlog.ACTION_USER_LOGIN);
|
||||
expect(results[0].creationTime).to.be.a(Date);
|
||||
|
||||
results = await notifications.list({}, 1, 10);
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('Settings', function () {
|
||||
|
||||
it('can set backup config', async function () {
|
||||
let backupConfig = await settings.getBackupConfig();
|
||||
backupConfig.backupFolder = '/tmp/backups';
|
||||
backupConfig = Object.assign({}, backupConfig, { backupFolder: '/tmp/backups' });
|
||||
await settings.setBackupConfig(backupConfig);
|
||||
|
||||
const newBackupConfig = await settings.getBackupConfig();
|
||||
|
||||
@@ -32,18 +32,18 @@ describe('Volumes', function () {
|
||||
|
||||
let volume;
|
||||
it('can add volume', async function () {
|
||||
const id = await volumes.add({ name: 'music', hostPath: '/mnt/cloudron-test-music', mountType: 'filesystem', mountOptions: {} }, auditSource);
|
||||
const id = await volumes.add({ name: 'music', mountType: 'filesystem', mountOptions: { hostPath: '/mnt/cloudron-test-music' } }, auditSource);
|
||||
expect(id).to.be.a('string');
|
||||
volume = { id, name: 'music', hostPath: '/mnt/cloudron-test-music' };
|
||||
});
|
||||
|
||||
it('cannot add duplicate path', async function () {
|
||||
const [error] = await safe(volumes.add({ name: 'music-dup', hostPath: '/mnt/cloudron-test-music', mountType: 'filesystem', mountOptions: {} }, auditSource));
|
||||
const [error] = await safe(volumes.add({ name: 'music-dup', mountType: 'filesystem', mountOptions: { hostPath: '/mnt/cloudron-test-music' } }, auditSource));
|
||||
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
|
||||
});
|
||||
|
||||
it('cannot add duplicate name', async function () {
|
||||
const [error] = await safe(volumes.add({ name: 'music', hostPath: '/mnt/cloudron-test-music2', mountType: 'filesystem', mountOptions: {} }, auditSource));
|
||||
const [error] = await safe(volumes.add({ name: 'music', mountType: 'filesystem', mountOptions: { hostPath: '/mnt/cloudron-test-music2' } }, auditSource));
|
||||
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user