Skip to content

Commit e39c62a

Browse files
committed
test for counter save after no update
PYTHON-547
1 parent 5ecb8b1 commit e39c62a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/integration/cqlengine/columns/test_counter_column.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,19 @@ def test_new_instance_defaults_to_zero(self):
112112
instance = TestCounterModel()
113113
assert instance.counter == 0
114114

115+
def test_save_after_no_update(self):
116+
expected_value = 15
117+
instance = TestCounterModel.create()
118+
instance.update(counter=expected_value)
119+
120+
# read back
121+
instance = TestCounterModel.get(partition=instance.partition)
122+
self.assertEqual(instance.counter, expected_value)
123+
124+
# save after doing nothing
125+
instance.save()
126+
self.assertEqual(instance.counter, expected_value)
127+
128+
# make sure there was no increment
129+
instance = TestCounterModel.get(partition=instance.partition)
130+
self.assertEqual(instance.counter, expected_value)

0 commit comments

Comments
 (0)