mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Add tests about flaky etags
This commit is contained in:
parent
cf17ac0509
commit
a79e30b0b0
1 changed files with 11 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ import pytest
|
||||||
|
|
||||||
import vdirsyncer.exceptions as exceptions
|
import vdirsyncer.exceptions as exceptions
|
||||||
from vdirsyncer.storage.base import Item
|
from vdirsyncer.storage.base import Item
|
||||||
from vdirsyncer.storage.memory import MemoryStorage
|
from vdirsyncer.storage.memory import MemoryStorage, _random_string
|
||||||
from vdirsyncer.sync import BothReadOnly, IdentConflict, StorageEmpty, \
|
from vdirsyncer.sync import BothReadOnly, IdentConflict, StorageEmpty, \
|
||||||
SyncConflict, sync
|
SyncConflict, sync
|
||||||
|
|
||||||
|
|
@ -404,10 +404,18 @@ class SyncMachine(RuleBasedStateMachine):
|
||||||
def _get_items(storage):
|
def _get_items(storage):
|
||||||
return sorted(item.raw for etag, item in storage.items.values())
|
return sorted(item.raw for etag, item in storage.items.values())
|
||||||
|
|
||||||
@rule(target=Storage, read_only=st.booleans())
|
@rule(target=Storage, read_only=st.booleans(), flaky_etags=st.booleans())
|
||||||
def newstorage(self, read_only):
|
def newstorage(self, read_only, flaky_etags):
|
||||||
s = MemoryStorage()
|
s = MemoryStorage()
|
||||||
s.read_only = read_only
|
s.read_only = read_only
|
||||||
|
if flaky_etags:
|
||||||
|
def get(href):
|
||||||
|
_, item = s.items[href]
|
||||||
|
etag = _random_string()
|
||||||
|
s.items[href] = etag, item
|
||||||
|
return item, etag
|
||||||
|
s.get = get
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
@rule(target=Status)
|
@rule(target=Status)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue