reformatting

This commit is contained in:
Blake Eggleston
2014-03-11 13:08:53 -07:00
parent 6b0a4dc3bd
commit 1c6660199b

View File

@@ -3,7 +3,6 @@ Tests surrounding the blah.timestamp( timedelta(seconds=30) ) format.
""" """
from datetime import timedelta, datetime from datetime import timedelta, datetime
import unittest
from uuid import uuid4 from uuid import uuid4
import mock import mock
import sure import sure
@@ -19,12 +18,15 @@ class TestTimestampModel(Model):
class BaseTimestampTest(BaseCassEngTestCase): class BaseTimestampTest(BaseCassEngTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(BaseTimestampTest, cls).setUpClass() super(BaseTimestampTest, cls).setUpClass()
sync_table(TestTimestampModel) sync_table(TestTimestampModel)
class BatchTest(BaseTimestampTest): class BatchTest(BaseTimestampTest):
def test_batch_is_included(self): def test_batch_is_included(self):
with mock.patch.object(ConnectionPool, "execute") as m, BatchQuery(timestamp=timedelta(seconds=30)) as b: with mock.patch.object(ConnectionPool, "execute") as m, BatchQuery(timestamp=timedelta(seconds=30)) as b:
TestTimestampModel.batch(b).create(count=1) TestTimestampModel.batch(b).create(count=1)
@@ -32,7 +34,6 @@ class BatchTest(BaseTimestampTest):
"USING TIMESTAMP".should.be.within(m.call_args[0][0]) "USING TIMESTAMP".should.be.within(m.call_args[0][0])
class CreateWithTimestampTest(BaseTimestampTest): class CreateWithTimestampTest(BaseTimestampTest):
def test_batch(self): def test_batch(self):
@@ -44,8 +45,6 @@ class CreateWithTimestampTest(BaseTimestampTest):
query.should.match(r"INSERT.*USING TIMESTAMP") query.should.match(r"INSERT.*USING TIMESTAMP")
query.should_not.match(r"TIMESTAMP.*INSERT") query.should_not.match(r"TIMESTAMP.*INSERT")
def test_timestamp_not_included_on_normal_create(self): def test_timestamp_not_included_on_normal_create(self):
with mock.patch.object(ConnectionPool, "execute") as m: with mock.patch.object(ConnectionPool, "execute") as m:
TestTimestampModel.create(count=2) TestTimestampModel.create(count=2)
@@ -90,7 +89,9 @@ class UpdateWithTimestampTest(BaseTimestampTest):
query = m.call_args[0][0] query = m.call_args[0][0]
"USING TIMESTAMP".should.be.within(query) "USING TIMESTAMP".should.be.within(query)
class DeleteWithTimestampTest(BaseTimestampTest): class DeleteWithTimestampTest(BaseTimestampTest):
def test_non_batch(self): def test_non_batch(self):
""" """
we don't expect the model to come back at the end because the deletion timestamp should be in the future we don't expect the model to come back at the end because the deletion timestamp should be in the future
@@ -122,10 +123,6 @@ class DeleteWithTimestampTest(BaseTimestampTest):
tmp.update() tmp.update()
tmp._timestamp.shouldnt.be.ok tmp._timestamp.shouldnt.be.ok
def test_blind_delete(self): def test_blind_delete(self):
""" """
we don't expect the model to come back at the end because the deletion timestamp should be in the future we don't expect the model to come back at the end because the deletion timestamp should be in the future
@@ -178,6 +175,3 @@ class DeleteWithTimestampTest(BaseTimestampTest):
TestTimestampModel.get(id=uid) TestTimestampModel.get(id=uid)