Skip to content

Commit 6f10fc4

Browse files
authored
Merge pull request #7742 from Countly/refactor/db-export-field-handling
tests: assert /o/export/db rejects session store and system index col…
2 parents d682b4e + 0bb1cea commit 6f10fc4

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

test/2.api/18.query.read.endpoints.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var request = require('supertest');
2+
var should = require('should');
23
var testUtils = require("../testUtils");
34
request = request(testUtils.url);
45

@@ -103,6 +104,34 @@ describe('Testing query-validated read endpoints (happy path)', function() {
103104
done();
104105
});
105106
});
107+
108+
it('should not export the session store collection', function(done) {
109+
request
110+
.get('/o/export/db?api_key=' + API_KEY_ADMIN + '&app_id=' + APP_ID + '&collection=sessions_&type=json&filter=' + emptyQuery)
111+
.expect(401)
112+
.end(function(err, res) {
113+
if (err) {
114+
return done(err);
115+
}
116+
var ob = JSON.parse(res.text);
117+
ob.should.have.property('result', 'User does not have access right for this collection');
118+
done();
119+
});
120+
});
121+
122+
it('should not export system index metadata', function(done) {
123+
request
124+
.get('/o/export/db?api_key=' + API_KEY_ADMIN + '&app_id=' + APP_ID + '&collection=system.indexes&type=json&filter=' + emptyQuery)
125+
.expect(401)
126+
.end(function(err, res) {
127+
if (err) {
128+
return done(err);
129+
}
130+
var ob = JSON.parse(res.text);
131+
ob.should.have.property('result', 'User does not have access right for this collection');
132+
done();
133+
});
134+
});
106135
});
107136

108137
describe('GET /o (method=all_apps)', function() {

0 commit comments

Comments
 (0)