Exemplo n.º 1
0
def test_patch_completer():
    client = Client("127.0.0.1", "6379", None)
    completer = IRedisCompleter()
    client.pre_hook("MGET foo bar hello world", "MGET", "foo bar hello world",
                    completer)
    assert completer.key_completer.words == ["world", "hello", "bar", "foo"]
    assert completer.key_completer.words == ["world", "hello", "bar", "foo"]

    client.pre_hook("GET bar", "GET", "bar", completer)
    assert completer.key_completer.words == ["bar", "world", "hello", "foo"]
Exemplo n.º 2
0
def test_patch_completer(completer):
    client = Client("127.0.0.1", "6379", None)
    client.pre_hook("MGET foo bar hello world", completer)
    assert completer.completers["key"].words == [
        "world", "hello", "bar", "foo"
    ]
    assert completer.completers["keys"].words == [
        "world", "hello", "bar", "foo"
    ]
    client.pre_hook("GET bar", completer)
    assert completer.completers["keys"].words == [
        "bar", "world", "hello", "foo"
    ]
Exemplo n.º 3
0
def test_patch_completer():
    client = Client("127.0.0.1", "6379", None)
    grammar = get_command_grammar("MGET")
    completer = GrammarCompleter(grammar, completer_mapping)
    client.pre_hook(
        "MGET foo bar hello world", "MGET", "foo bar hello world", completer
    )
    assert completer.completers["key"].words == ["world", "hello", "bar", "foo"]
    assert completer.completers["keys"].words == ["world", "hello", "bar", "foo"]

    grammar = get_command_grammar("GET")
    completer = GrammarCompleter(grammar, completer_mapping)
    client.pre_hook("GET bar", "GET", "bar", completer)
    assert completer.completers["keys"].words == ["bar", "world", "hello", "foo"]