You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
* fix #1904 - ACL DRYRUN * clean code * fix test
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import CLUSTER_COMMANDS from '../cluster/commands';
|
||||
import * as ACL_CAT from '../commands/ACL_CAT';
|
||||
import * as ACL_DELUSER from '../commands/ACL_DELUSER';
|
||||
import * as ACL_DRYRUN from '../commands/ACL_DRYRUN';
|
||||
import * as ACL_GENPASS from '../commands/ACL_GENPASS';
|
||||
import * as ACL_GETUSER from '../commands/ACL_GETUSER';
|
||||
import * as ACL_LIST from '../commands/ACL_LIST';
|
||||
@@ -115,6 +116,8 @@ export default {
|
||||
aclCat: ACL_CAT,
|
||||
ACL_DELUSER,
|
||||
aclDelUser: ACL_DELUSER,
|
||||
ACL_DRYRUN,
|
||||
aclDryRun: ACL_DRYRUN,
|
||||
ACL_GENPASS,
|
||||
aclGenPass: ACL_GENPASS,
|
||||
ACL_GETUSER,
|
||||
|
21
packages/client/lib/commands/ACL_DRYRUN.spec.ts
Normal file
21
packages/client/lib/commands/ACL_DRYRUN.spec.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './ACL_DRYRUN';
|
||||
|
||||
describe('ACL DRYRUN', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('default', ['GET', 'key']),
|
||||
['ACL', 'DRYRUN', 'default', 'GET', 'key']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.aclDryRun', async client => {
|
||||
assert.equal(
|
||||
await client.aclDryRun('default', ['GET', 'key']),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
18
packages/client/lib/commands/ACL_DRYRUN.ts
Normal file
18
packages/client/lib/commands/ACL_DRYRUN.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
username: RedisCommandArgument,
|
||||
command: Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
return [
|
||||
'ACL',
|
||||
'DRYRUN',
|
||||
username,
|
||||
...command
|
||||
];
|
||||
}
|
||||
|
||||
export declare function transformReply(): RedisCommandArgument;
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './BLMPOP';
|
||||
|
||||
describe('BLMPOP', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './BZMPOP';
|
||||
|
||||
describe('BZMPOP', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLUSTER_LINKS';
|
||||
|
||||
describe('CLUSTER LINKS', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './COMMAND_GETKEYSANDFLAGS';
|
||||
|
||||
describe('COMMAND GETKEYSANDFLAGS', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments, FilterBy } from './COMMAND_LIST';
|
||||
|
||||
describe('COMMAND LIST', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils from '../test-utils';
|
||||
import { transformArguments } from './EVALSHA_RO';
|
||||
|
||||
describe('EVALSHA_RO', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './EVAL_RO';
|
||||
|
||||
describe('EVAL_RO', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -3,8 +3,8 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './EXPIRETIME';
|
||||
|
||||
describe('EXPIRETIME', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key'),
|
||||
|
@@ -4,7 +4,7 @@ import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import { transformArguments } from './FCALL';
|
||||
|
||||
describe('FCALL', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -4,7 +4,7 @@ import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import { transformArguments } from './FCALL_RO';
|
||||
|
||||
describe('FCALL_RO', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -4,7 +4,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_DELETE';
|
||||
|
||||
describe('FUNCTION DELETE', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_DUMP';
|
||||
|
||||
describe('FUNCTION DUMP', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_FLUSH';
|
||||
|
||||
describe('FUNCTION FLUSH', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_KILL';
|
||||
|
||||
describe('FUNCTION KILL', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -4,7 +4,7 @@ import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import { transformArguments } from './FUNCTION_LIST';
|
||||
|
||||
describe('FUNCTION LIST', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -4,7 +4,7 @@ import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import { transformArguments } from './FUNCTION_LIST_WITHCODE';
|
||||
|
||||
describe('FUNCTION LIST WITHCODE', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -4,7 +4,7 @@ import { MATH_FUNCTION } from '../client/index.spec';
|
||||
import { transformArguments } from './FUNCTION_LOAD';
|
||||
|
||||
describe('FUNCTION LOAD', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_RESTORE';
|
||||
|
||||
describe('FUNCTION RESTORE', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_STATS';
|
||||
|
||||
describe('FUNCTION STATS', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './LMPOP';
|
||||
|
||||
describe('LMPOP', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './PEXPIRETIME';
|
||||
|
||||
describe('PEXPIRETIME', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './SINTERCARD';
|
||||
|
||||
describe('SINTERCARD', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './SORT_RO';
|
||||
|
||||
describe('SORT_RO', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './ZINTERCARD';
|
||||
|
||||
describe('ZINTERCARD', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
@@ -3,7 +3,7 @@ import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './ZMPOP';
|
||||
|
||||
describe('ZMPOP', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
|
Reference in New Issue
Block a user