def test_flush(self): db_alias = get_cassandra_db_alias() call_command('flush', database=db_alias, noinput=True, interactive=False)
def test_sync_cassandra_creates_keyspace_and_tables( self, sync_table_mock, create_keyspace_mock): alias = get_cassandra_db_alias() call_command('sync_cassandra', database=alias) replication_factor = 1 all_models = list(chain.from_iterable( self.connection.introspection.cql_models.values())) create_keyspace_mock.assert_called_once_with(self.keyspace, replication_factor) for model in all_models: sync_table_mock.assert_has_call(call(model))
def test_sync_cassandra_creates_keyspace_and_tables(self, mock_management): alias = get_cassandra_db_alias() call_command('sync_cassandra', database=alias) replication_factor = 1 all_models = list( chain.from_iterable( self.connection.introspection.cql_models.values())) mock_management.create_keyspace_simple.assert_called_once_with( self.keyspace, replication_factor) for model in all_models: mock_management.sync_table.assert_has_call(call(model))
def test_sync_cassandra_creates_keyspace_and_tables(self, mock_management): alias = get_cassandra_db_alias() call_command('sync_cassandra', database=alias) replication_factor = 1 all_models = list(chain.from_iterable( self.connection.introspection.cql_models.values())) mock_management.create_keyspace_simple.assert_called_once_with( self.keyspace, replication_factor, connections=[alias] ) for model in all_models: mock_management.sync_table.assert_has_call(call(model))
def test_sync_cassandra_creates_keyspace_and_tables( self, sync_table_mock, create_keyspace_mock): alias = get_cassandra_db_alias() call_command('sync_cassandra', database=alias) options = self.connection.settings_dict.get('OPTIONS', {}) replication_opts = options.get('replication', {}) strategy_class = 'SimpleStrategy' replication_factor = 1 all_models = list(chain.from_iterable( self.connection.introspection.cql_models.values())) create_keyspace_mock.assert_called_once_with( self.keyspace, strategy_class, replication_factor, **replication_opts) for model in all_models: sync_table_mock.assert_has_call(call(model))
def test_sync_cassandra_creates_keyspace_and_tables(self, mock_management): alias = get_cassandra_db_alias() call_command('sync_cassandra', database=alias) replication_factor = 1 all_models = list( chain.from_iterable( self.connection.introspection.cql_models.values())) mock_management.create_keyspace_simple.assert_called_once_with( self.keyspace, replication_factor, connections=[alias]) mock_management.Model = (Model, DjangoCassandraModel) calls = [] for model in all_models: calls.append( call(model, keyspaces=[self.keyspace], connections=[alias])) mock_management.sync_table.assert_has_calls(calls, any_order=True)
def test_flush(self): db_alias = get_cassandra_db_alias() call_command('flush', database=db_alias, interactive=False)