'test for materialized view metadata dropping
test_materialized_view_metadata_drop tests that materialized view metadata is properly removed implicitly in
both keyspace and table metadata once that view is dropped. It creates a simple base table and then creates a view
based on that table. It then drops that materalized view and checks that the materialized view metadata is removed
from the keyspace and table metadata.
@since 3.0.0
@jira_ticket PYTHON-371
@expected_result Materialized view metadata in both the ks and table should be removed with the view is dropped.
@test_category metadata'

def test_materialized_view_metadata_drop(self):

    self.session.execute('DROP    MATERIALIZED    VIEW    {0}.mv1'.format(self.keyspace_name))
    self.assertNotIn('mv1', self.cluster.metadata.keyspaces[self.keyspace_name].tables[self.function_table_name].views)
    self.assertNotIn('mv1', self.cluster.metadata.keyspaces[self.keyspace_name].views)
    self.assertDictEqual({}, self.cluster.metadata.keyspaces[self.keyspace_name].tables[self.function_table_name].views)
    self.assertDictEqual({}, self.cluster.metadata.keyspaces[self.keyspace_name].views)
    self.session.execute('CREATE    MATERIALIZED    VIEW    {0}.mv1    AS    SELECT    c    FROM    {0}.{1}    WHERE    c    IS    NOT    NULL    PRIMARY    KEY    (pk,    c)'.format(self.keyspace_name, self.function_table_name))
