MCPcopy
hub / github.com/pimutils/vdirsyncer / test_fuzzing

Function test_fuzzing

tests/unit/test_metasync.py:135–156  ·  view source on GitHub ↗
(a, b, status, keys, conflict_resolution)

Source from the content-addressed store, hash-verified

133@example(a={'0': '0'}, b={'0': '1'}, status={'0': '0'}, keys={'0'},
134 conflict_resolution='a wins')
135def test_fuzzing(a, b, status, keys, conflict_resolution):
136 def _get_storage(m, instance_name):
137 s = MemoryStorage(instance_name=instance_name)
138 s.metadata = m
139 return s
140
141 a = _get_storage(a, 'A')
142 b = _get_storage(b, 'B')
143
144 winning_storage = (a if conflict_resolution == 'a wins' else b)
145 expected_values = {key: winning_storage.get_meta(key)
146 for key in keys
147 if key not in status}
148
149 metasync(a, b, status,
150 keys=keys, conflict_resolution=conflict_resolution)
151
152 for key in keys:
153 s = status.get(key, '')
154 assert a.get_meta(key) == b.get_meta(key) == s
155 if expected_values.get(key, '') and s:
156 assert s == expected_values[key]

Callers

nothing calls this directly

Calls 4

metasyncFunction · 0.90
_get_storageFunction · 0.85
get_metaMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected