Beispiel #1
0
 def test_if_not_exists(self):
     assignment = {'name': 'foo'}
     op = (Insert(self.column_family).values(**assignment).if_not_exists())
     cql, args = op.statement()
     query = self.get_query(assignment)
     self.assertEquals(cql, '{} IF NOT EXISTS'.format(query))
     self.assertEquals(args, assignment.values())
Beispiel #2
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)
Beispiel #3
0
 def insert_into(column_family, keyspace=None):
     return Insert(column_family, keyspace)
Beispiel #4
0
 def test_valid(self):
     assignment = {'first': 'foo', 'last': 'bar', 'age': 13}
     op = (Insert(self.column_family).values(**assignment))
     cql, args = op.statement()
     self.assertEquals(cql, self.get_query(assignment))
     self.assertEquals(args, assignment.values())
Beispiel #5
0
 def test_no_assignment(self):
     op = Insert(self.column_family)
     self.assertRaises(ValidationError, op.statement)