Added more test cases for GET /records/{recordId}/credentials

This commit is contained in:
Lukas Metzger 2018-03-31 13:48:12 +02:00
parent 61430dd1d4
commit 2447d10dd2

View file

@ -21,5 +21,50 @@ test.run(async function () {
type: 'key'
}
], 'Result fail for ' + res.config.url);
//Test query
var res = await req({
url: '/records/4/credentials',
method: 'get'
});
assert.equal(res.status, 200, 'Status should be OK');
assert.equal(res.data.results, [
{
id: 2,
description: 'Key Test',
type: 'key'
}
], 'Result fail for ' + res.config.url);
});
await test('user', async function (assert, req) {
//Test query
var res = await req({
url: '/records/1/credentials',
method: 'get'
});
assert.equal(res.status, 200, 'Status should be OK');
assert.equal(res.data.results, [
{
id: 1,
description: 'Password Test',
type: 'password'
},
{
id: 3,
description: 'Key Test 2',
type: 'key'
}
], 'Result fail for ' + res.config.url);
//Test permissions
var res = await req({
url: '/records/4/credentials',
method: 'get'
});
assert.equal(res.status, 403, 'Request should fail without permissions.');
});
});