mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
Feature/retrieve registered users (#243)
* add GET /Accounts/:sid/RegisteredSipUsers * fix vulnerabilities
This commit is contained in:
@@ -12,6 +12,7 @@ process.on('unhandledRejection', (reason, p) => {
|
||||
|
||||
test('client test', async(t) => {
|
||||
const app = require('../app');
|
||||
const {registrar} = app.locals;
|
||||
|
||||
try {
|
||||
let result;
|
||||
@@ -35,6 +36,7 @@ test('client test', async(t) => {
|
||||
body: {
|
||||
name: 'sample_account',
|
||||
service_provider_sid: sp_sid,
|
||||
sip_realm: 'drachtio.org',
|
||||
registration_hook: {
|
||||
url: 'http://example.com/reg',
|
||||
method: 'get'
|
||||
@@ -60,6 +62,26 @@ test('client test', async(t) => {
|
||||
t.ok(result.statusCode === 201, 'successfully created Client');
|
||||
const sid = result.body.sid;
|
||||
|
||||
/* register the client */
|
||||
const r = await registrar.add(
|
||||
"dhorton@drachtio.org",
|
||||
{
|
||||
contact: "10.10.1.1",
|
||||
sbcAddress: "192.168.1.1",
|
||||
protocol: "udp",
|
||||
},
|
||||
5
|
||||
);
|
||||
t.ok(r, 'successfully registered Client');
|
||||
|
||||
/* query all registered clients */
|
||||
result = await request.get(`/Accounts/${account_sid}/RegisteredSipUsers`, {
|
||||
auth: authAdmin,
|
||||
json: true,
|
||||
});
|
||||
t.ok(result.length === 1 && result[0] === 'dhorton@drachtio.org',
|
||||
'successfully queried all registered clients');
|
||||
|
||||
/* query all entity */
|
||||
result = await request.get('/Clients', {
|
||||
auth: authAdmin,
|
||||
|
||||
Reference in New Issue
Block a user