'tests that insertion with if_not_exists work as expected'

@unittest.skipUnless((PROTOCOL_VERSION >= 2), 'only    runs    against    the    cql3    protocol    v2.0')
def test_insert_if_not_exists(self):

    id = uuid4()
    TestIfNotExistsModel.create(id=id, count=8, text='123456789')
    with self.assertRaises(LWTException) as assertion:
        TestIfNotExistsModel.if_not_exists().create(id=id, count=9, text='111111111111')
    with self.assertRaises(LWTException) as assertion:
        TestIfNotExistsModel.objects(count=9, text='111111111111').if_not_exists().create(id=id)
    self.assertEqual(assertion.exception.existing, {'count': 8, 'id': id, 'text': '123456789', '[applied]': False})
    q = TestIfNotExistsModel.objects(id=id)
    self.assertEqual(len(q), 1)
    tm = q.first()
    self.assertEqual(tm.count, 8)
    self.assertEqual(tm.text, '123456789')
