-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-20021 Add cqlsh autocompletion for the identity mapping feature #4408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
3819c51
8007fc3
0930359
55959b9
5a78cfd
ee5eeb5
c434d9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from .test_cqlsh_completion import CqlshCompletionCase | ||
|
||
|
||
class TestIdentityMappingsCompletion(CqlshCompletionCase): | ||
|
||
|
||
""" | ||
Autcomplete Tests for ADD and DROP Identity Mappings for @cql3handling.py | ||
""" | ||
|
||
def add_test_user_autocomplete(self): | ||
self.trycompletions('ADD U', immediate='SER ') | ||
|
||
|
||
def add_test_exists_autocomplete(self): | ||
self.trycompletions('ADD USER IF ', immediate='NOT EXISTS ') | ||
self.trycompletions('ADD USER IF NOT ', immediate='EXISTS ') | ||
|
||
def test_expect_str_literal_add_autocomplete(self): | ||
self.trycompletions('ADD USER ', | ||
choices=['<pgStringLiteral>', '<quotedStringLiteral>', 'IF']) | ||
|
||
|
||
def add_test_to_autocomplete(self): | ||
self.trycompletions("ADD USER '[email protected]' ", immediate='TO ') | ||
self.trycompletions("ADD USER '[email protected]' T", immediate='O ') | ||
|
||
def add_test_role_autocomplete(self): | ||
self.trycompletions("ADD USER '[email protected]' TO ", immediate='ROLE ') | ||
self.trycompletions("ADD USER '[email protected]' TO R", immediate='OLE ') | ||
|
||
def add_test_rolename_autocomplete(self): | ||
self.trycompletions("ADD USER '[email protected]' TO ROLE ", | ||
choices=['<identifier>', '<quotedName>'], | ||
other_choices_ok=True) | ||
|
||
def add_test_complete_user_full_statement(self): | ||
self.trycompletions("ADD USER IF NOT EXISTS '[email protected]' TO ROLE data_engineer ", | ||
choices=[';']) | ||
|
||
def drop_test_autocomplete(self): | ||
self.trycompletions('DROP ', | ||
|
||
choices=['AGGREGATE', 'COLUMNFAMILY', 'FUNCTION', | ||
'INDEX', 'KEYSPACE', 'ROLE', 'TABLE', | ||
'TRIGGER', 'TYPE', 'USER', 'MATERIALIZED']) | ||
|
||
def drop_test_user_autcomplete(self): | ||
self.trycompletions('DROP USER ', | ||
choices=['<pgStringLiteral>', '<quotedStringLiteral>', 'IF']) | ||
|
||
def drop_test_exists(self): | ||
self.trycompletions('DROP USER IF ', immediate='EXISTS ') | ||
self.trycompletions('DROP USER IF EXISTS ', | ||
choices=['<pgStringLiteral>', '<quotedStringLiteral>']) | ||
|
||
def test_complete_drop_user_statement_end(self): | ||
self.trycompletions("DROP USER '[email protected]' ", choices=[';']) | ||
self.trycompletions("DROP USER IF EXISTS '[email protected]' ", choices=[';']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the statement is
ADD IDENTITY IF NOT EXISTS '<identity>' TO ROLE '<role>'
similarly for drop statement.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. Changes also reflected in test file
Let me know if a grammar should be expressed specifically for
identity
instead of usingstringliteral