'Test for CQL keywords as names
test_keywords_as_names tests that CQL keywords are properly and automatically quoted in cqlengine. It creates
a keyspace, keyspace, which should be automatically quoted to "keyspace" in CQL. It then creates a table, table,
which should also be automatically quoted to "table". It then verfies that operations can be done on the
"keyspace"."table" which has been created. It also verifies that table alternations work and operations can be
performed on the altered table.
@since 2.6.0
@jira_ticket PYTHON-244
@expected_result Cqlengine should quote CQL keywords properly when creating keyspaces and tables.
@test_category schema:generation'

def test_keywords_as_names(self):

    create_keyspace_simple('keyspace', 1)
    class table(Model, ):
        __keyspace__ = 'keyspace'
        select = columns.Integer(primary_key=True)
        table = columns.Text()
    drop_table(table)
    sync_table(table)
    created = table.create(select=0, table='table')
    selected = table.objects(select=0)[0]
    self.assertEqual(created.select, selected.select)
    self.assertEqual(created.table, selected.table)
    class table(Model, ):
        __keyspace__ = 'keyspace'
        select = columns.Integer(primary_key=True)
        table = columns.Text()
        where = columns.Text()
    sync_table(table)
    created = table.create(select=1, table='table')
    selected = table.objects(select=1)[0]
    self.assertEqual(created.select, selected.select)
    self.assertEqual(created.table, selected.table)
    self.assertEqual(created.where, selected.where)
    drop_keyspace('keyspace')
