2016-03-01 16:03:37 -08:00
|
|
|
'use strict';
|
|
|
|
|
|
2018-09-24 17:07:51 -04:00
|
|
|
const request = require('../lib/request');
|
2016-03-01 07:35:28 -08:00
|
|
|
|
|
|
|
|
describe('features', () => {
|
2019-06-03 23:58:21 +02:00
|
|
|
it('should return the serverInfo', async () => {
|
|
|
|
|
const response = await request({
|
2018-09-24 17:07:51 -04:00
|
|
|
url: 'http://localhost:8378/1/serverInfo',
|
|
|
|
|
json: true,
|
|
|
|
|
headers: {
|
|
|
|
|
'X-Parse-Application-Id': 'test',
|
|
|
|
|
'X-Parse-REST-API-Key': 'rest',
|
2019-06-03 23:58:21 +02:00
|
|
|
'X-Parse-Master-Key': 'test',
|
2018-09-01 13:58:06 -04:00
|
|
|
},
|
2019-06-03 23:58:21 +02:00
|
|
|
});
|
|
|
|
|
const data = response.data;
|
|
|
|
|
expect(data).toBeDefined();
|
|
|
|
|
expect(data.features).toBeDefined();
|
|
|
|
|
expect(data.parseServerVersion).toBeDefined();
|
|
|
|
|
expect(data.database).toBeDefined();
|
|
|
|
|
expect(['MongoDB', 'PostgreSQL']).toContain(data.database.engine);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('requires the master key to get features', async done => {
|
|
|
|
|
try {
|
|
|
|
|
await request({
|
|
|
|
|
url: 'http://localhost:8378/1/serverInfo',
|
|
|
|
|
json: true,
|
|
|
|
|
headers: {
|
|
|
|
|
'X-Parse-Application-Id': 'test',
|
|
|
|
|
'X-Parse-REST-API-Key': 'rest',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
done.fail(
|
|
|
|
|
'The serverInfo request should be rejected without the master key'
|
2018-09-24 17:07:51 -04:00
|
|
|
);
|
2019-06-03 23:58:21 +02:00
|
|
|
} catch (error) {
|
|
|
|
|
expect(error.status).toEqual(403);
|
|
|
|
|
expect(error.data.error).toEqual('unauthorized: master key is required');
|
2018-09-24 17:07:51 -04:00
|
|
|
done();
|
2019-06-03 23:58:21 +02:00
|
|
|
}
|
2016-03-01 16:03:37 -08:00
|
|
|
});
|
2016-03-01 07:35:28 -08:00
|
|
|
});
|