Database version in features (#5627)
* adding database.version in the serverInfo (only MongoDB, it gives undefined when using Postgres) * . correction of old 'features' tests . adding engine and database in the StorageAdapter interface and implementations * . version retrieval done in performInitialization . PostgreSQL version * performInitialization now returns a Promise
This commit is contained in:
committed by
Diamond Lewis
parent
266d6328a3
commit
7fc0d45b89
@@ -3,20 +3,41 @@
|
||||
const request = require('../lib/request');
|
||||
|
||||
describe('features', () => {
|
||||
it('requires the master key to get features', done => {
|
||||
request({
|
||||
it('should return the serverInfo', async () => {
|
||||
const response = await request({
|
||||
url: 'http://localhost:8378/1/serverInfo',
|
||||
json: true,
|
||||
headers: {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
'X-Parse-Master-Key': 'test',
|
||||
},
|
||||
}).then(fail, response => {
|
||||
expect(response.status).toEqual(403);
|
||||
expect(response.data.error).toEqual(
|
||||
'unauthorized: master key is required'
|
||||
);
|
||||
done();
|
||||
});
|
||||
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'
|
||||
);
|
||||
} catch (error) {
|
||||
expect(error.status).toEqual(403);
|
||||
expect(error.data.error).toEqual('unauthorized: master key is required');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user