volumes: throw error for unsupported update

This commit is contained in:
Girish Ramakrishnan
2023-10-09 10:26:24 +05:30
parent 5bae308cae
commit 2f3fba346f
2 changed files with 8 additions and 12 deletions

View File

@@ -7,6 +7,7 @@
const common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance'),
superagent = require('superagent');
describe('Volumes API', function () {
@@ -67,17 +68,13 @@ describe('Volumes API', function () {
expect(response.body.hostPath).to.be('/media/cloudron-test-music');
});
it('can update volume', async function () {
let response = await superagent.post(`${serverUrl}/api/v1/volumes/${volumeId}`)
it('cannot update volume', async function () {
let [error, response] = await safe(superagent.post(`${serverUrl}/api/v1/volumes/${volumeId}`)
.query({ access_token: owner.token })
.send({ mountOptions: { hostPath: '/media/cloudron-test-music-2' }});
expect(response.statusCode).to.equal(204);
.send({ mountOptions: { hostPath: '/media/cloudron-test-music-2' }})
.ok(() => true));
response = await superagent.get(`${serverUrl}/api/v1/volumes/${volumeId}`)
.query({ access_token: owner.token });
expect(response.statusCode).to.equal(200);
expect(response.body.id).to.be(volumeId);
expect(response.body.hostPath).to.be('/media/cloudron-test-music-2');
expect(response.statusCode).to.equal(400); // cannot update filesytem
});
it('can delete volume', async function () {