Example #1
0
 def test_options(self):
     assignment = {'name': 'foo'}
     using = Using(ttl=10800)
     op = (Insert(
         self.column_family).values(**assignment).using(**using.options))
     cql, args = op.statement()
     query = self.get_query(assignment)
     self.assertEquals(cql, '{} {}'.format(query, using.cql))
     self.assertEquals(args, assignment.values() + using.values)
Example #2
0
 def test_options(self):
     assignment = Set(first='foo')
     condition = eq('last', 'bar')
     using = Using(ttl=10800)
     op = (Update(self.column_family).using(**using.options).set(
         **assignment.kwargs).where(condition))
     cql, args = op.statement()
     self.assertEquals(cql, self.get_query(assignment, condition, using))
     self.assertEquals(args,
                       using.values + assignment.values + condition.values)
Example #3
0
 def test_option_timedelta(self):
     kwargs = {'TTL': timedelta(hours=1)}
     cond = Using(**kwargs)
     self.assertEquals(cond.values, [3600])
Example #4
0
 def test_option_multi(self):
     kwargs = {'TTL': 3600, 'TIMESTAMP': 3600}
     cond = Using(**kwargs)
     self.assertEquals(cond.cql,
                       'USING {} %s AND {} %s'.format(*kwargs.keys()))
     self.assertEquals(cond.values, kwargs.values())
Example #5
0
 def test_option_single(self):
     cond = Using(ttl=3600)
     self.assertEquals(cond.cql, 'USING TTL %s')
     self.assertEquals(cond.values, [3600])
Example #6
0
	def using(self, **kwargs):
		self.options = Using(**kwargs)
		return self