def test_keyspace_network_topology(): """We would need a correct setup with multiple data centers to test this correctly""" cfg.dse_keyspace = TEST_KEYSPACE cfg.dse_strategy = "NetworkTopologyStrategy" cfg.dse_dc_replication_map = {"dc1": 1} assert initialise() == True destroy()
def test_destroy(): cfg.dse_keyspace = TEST_KEYSPACE initialise() create_keyspace_simple(TEST_KEYSPACE, 1, True) cluster = connection.get_cluster() assert TEST_KEYSPACE in cluster.metadata.keyspaces destroy() assert TEST_KEYSPACE not in cluster.metadata.keyspaces
def test_initialise(): cfg.dse_keyspace = TEST_KEYSPACE assert initialise() == True cluster = connection.get_cluster() # Check keyspace has been created assert cfg.dse_keyspace in cluster.metadata.keyspaces # Keyspace should already exist assert initialise() == True destroy()
def test_creation(): cfg.dse_keyspace = TEST_KEYSPACE initialise() create_tables() create_default_users() create_root() # Test creation if they already exist create_default_users() destroy()
def test_keyspace_simple(): cfg.dse_keyspace = TEST_KEYSPACE cfg.dse_strategy = "SimpleStrategy" assert initialise() == True cluster = connection.get_cluster() # Check keyspace has been created assert TEST_KEYSPACE in cluster.metadata.keyspaces destroy() # Check keyspace has been deleted assert TEST_KEYSPACE not in cluster.metadata.keyspaces
def drop(self): """Remove the keyspace""" print("*********************************") print("** WARNING **") print("*********************************") print("This will remove every data stored in the database.") confirm = input("Are you sure you want to continue ? [y/N] ") if confirm.lower() in ["true", "y", "yes"]: destroy() session = self.create_session() self.save_session(session)
def test_tables(): cfg.dse_keyspace = TEST_KEYSPACE # list of tables that has to be created ls_tables = {'data_object', 'group', 'notification', 'tree_node', 'user'} initialise() create_tables() cluster = connection.get_cluster() created_tables = set( cluster.metadata.keyspaces[TEST_KEYSPACE].tables.keys()) assert created_tables.difference(ls_tables) == set() destroy()
def teardown_module(module): destroy()