Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
	def columns(self, *args):
		self.selection = Columns(*args)
		return self
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
	def test_single(self):
		name = ['foo']
		columns = Columns(*name)
		self.assertEquals(columns.cql, name[0])
Exemplo n.º 6
0
	def test_multi(self):
		names = ['foo', 'bar']
		columns = Columns(*names)
		self.assertEquals(columns.cql, ', '.join(names))