Added get tests for user

This commit is contained in:
Lukas Metzger 2018-03-30 14:51:33 +02:00
parent 3f78bc8ea6
commit 3c6debf882
2 changed files with 64 additions and 0 deletions

View file

@ -106,4 +106,29 @@ test.run(async function () {
}
], 'Result fail for ' + res.config.url);
});
await test('user', async function (assert, req) {
//Type filter
var res = await req({
url: '/domains',
method: 'get'
});
assert.equal(res.status, 200, 'Status should be OK for user');
assert.equal(res.data.results, [
{
id: 1,
name: 'example.com',
type: 'MASTER',
records: 3
},
{
id: 2,
name: 'slave.example.net',
type: 'SLAVE',
master: '12.34.56.78',
records: 0
}
], 'Result fail for user on ' + res.config.url);
});
});

View file

@ -145,4 +145,43 @@ test.run(async function () {
domain: 3
}], 'Result fail for ' + res.config.url);
});
await test('user', async function (assert, req) {
//Type filter
var res = await req({
url: '/records',
method: 'get'
});
assert.equal(res.status, 200, 'Status should be OK for user');
assert.equal(res.data.results, [
{
id: 1,
name: 'test.example.com',
type: 'A',
content: '12.34.56.78',
priority: 0,
ttl: 86400,
domain: 1
},
{
id: 2,
name: 'sdfdf.example.com',
type: 'TXT',
content: 'foo bar baz',
priority: 10,
ttl: 60,
domain: 1
},
{
id: 3,
name: 'foo.example.com',
type: 'AAAA',
content: '::1',
priority: 0,
ttl: 86400,
domain: 1
}
], 'Result fail for user on ' + res.config.url);
});
});