def test_selection(self): condition = eq('name', 'foo') selection = Columns('first', 'last') op = (Delete( self.column_family).columns(*selection.args).where(condition)) cql, args = op.statement() self.assertEquals(cql, self.get_query(condition, selection)) self.assertEquals(args, condition.values + selection.values)
def test_limit(self): selection = Columns('first', 'last') limit = Limit(5) op = (Select(self.column_family).columns(*selection.args).limit( limit.value)) cql, args = op.statement() self.assertEquals(cql, '{} {}'.format(self.get_query(selection), limit.cql)) self.assertEquals(args, selection.values + limit.values)
def columns(self, *args): self.selection = Columns(*args) return self
def test_selection(self): selection = Columns('first', 'last') op = (Select(self.column_family).columns(*selection.args)) cql, args = op.statement() self.assertEquals(cql, self.get_query(selection)) self.assertEquals(args, selection.values)
def test_single(self): name = ['foo'] columns = Columns(*name) self.assertEquals(columns.cql, name[0])
def test_multi(self): names = ['foo', 'bar'] columns = Columns(*names) self.assertEquals(columns.cql, ', '.join(names))