Skip to content

Commit

Permalink
Removed resolves
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong committed Sep 19, 2023
1 parent 17cab16 commit a54d6de
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions test/integration/helpers-secure/security.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

const { test } = require('tap');
const { Client } = require('../../../');
const { sleep } = require('../helper')

const client = new Client({
ssl: {
Expand All @@ -25,32 +24,25 @@ const client = new Client({
const security = client.security;

test('Security: User', async (t) => {
await security.createUser({ username: 'test_user', body: { password: 'test_password' } });
sleep(1000);
t.resolves(security.getUser({ username: 'test_user' })); // found
await security.createUser({ username: 'test_user', body: { password: 'aasodu23497@lksd' } });
await security.getUser({ username: 'test_user' });
await security.deleteUser({ username: 'test_user' });
sleep(1000);
t.rejects(security.getUser({ username: 'test_user' })); // not found
t.rejects(security.getUser({ username: 'test_user' }));
});

test('Security: Role', async (t) => {
await security.createRole({ role: 'test_role', body: { cluster_permissions: [] } });
sleep(1000);
t.resolves(security.getRole({ role: 'test_role' })); // found
await security.getRole({ role: 'test_role' });
await security.deleteRole({ role: 'test_role' });
sleep(1000);
t.rejects(security.getRole({ role: 'test_role' })); // not found
t.rejects(security.getRole({ role: 'test_role' }));
});

test('Security: RoleMapping', async (t) => {
await security.createRole({ role: 'test_role', body: { cluster_permissions: [] } });
sleep(1000);
await security.createRoleMapping({ role: 'test_role', body: { users: [] } });
sleep(1000);
t.resolves(security.getRoleMapping({ role: 'test_role' })); // found
await security.getRoleMapping({ role: 'test_role' });
await security.deleteRoleMapping({ role: 'test_role' });
sleep(1000);
t.rejects(security.getRoleMapping({ role: 'test_role' })); // not found
t.rejects(security.getRoleMapping({ role: 'test_role' }));
await security.deleteRole({ role: 'test_role' });
});

Expand All @@ -59,18 +51,14 @@ test('Security: ActionGroup', async (t) => {
action_group: 'test_action_group',
body: { allowed_actions: [] },
});
sleep(100);
t.resolves(security.getActionGroup({ action_group: 'test_action_group' })); // found
await security.getActionGroup({ action_group: 'test_action_group' }); // found
await security.deleteActionGroup({ action_group: 'test_action_group' });
sleep(100);
t.rejects(security.getActionGroup({ action_group: 'test_action_group' })); // not found
});

test('Security: Tenant', async (t) => {
await security.createTenant({ tenant: 'test_tenant', body: { description: 'test_tenant' } });
sleep(100);
t.resolves(security.getTenant({ tenant: 'test_tenant' })); // found
await security.getTenant({ tenant: 'test_tenant' });
await security.deleteTenant({ tenant: 'test_tenant' });
sleep(100);
t.rejects(security.getTenant({ tenant: 'test_tenant' })); // not found
t.rejects(security.getTenant({ tenant: 'test_tenant' }));
});

0 comments on commit a54d6de

Please sign in to comment.