mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Loosen up tests again...
We shouldn't test item uploading functions in discovery
This commit is contained in:
parent
fe1d141b34
commit
36c0607b45
2 changed files with 4 additions and 10 deletions
|
|
@ -98,7 +98,7 @@ class StorageTests(object):
|
||||||
assert list(s.list())
|
assert list(s.list())
|
||||||
|
|
||||||
def test_discover(self):
|
def test_discover(self):
|
||||||
collections = {}
|
collections = set()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
for i in range(1, 5):
|
for i in range(1, 5):
|
||||||
|
|
@ -108,9 +108,7 @@ class StorageTests(object):
|
||||||
i += 1
|
i += 1
|
||||||
s = self.storage_class(
|
s = self.storage_class(
|
||||||
**self.get_storage_args(collection=collection))
|
**self.get_storage_args(collection=collection))
|
||||||
item = self._create_bogus_item(str(i))
|
collections.add(s.collection)
|
||||||
s.upload(item)
|
|
||||||
collections[s.collection] = normalize_item(item)
|
|
||||||
main() # remove leftover variables from loop for safety
|
main() # remove leftover variables from loop for safety
|
||||||
|
|
||||||
d = self.storage_class.discover(
|
d = self.storage_class.discover(
|
||||||
|
|
@ -124,10 +122,7 @@ class StorageTests(object):
|
||||||
# collections, as they are not relevant to us.
|
# collections, as they are not relevant to us.
|
||||||
print('Skipping {}'.format(s.collection))
|
print('Skipping {}'.format(s.collection))
|
||||||
continue
|
continue
|
||||||
((href, etag),) = s.list()
|
collections.remove(s.collection)
|
||||||
item, etag = s.get(href)
|
|
||||||
assert collections[s.collection] == normalize_item(item)
|
|
||||||
del collections[s.collection]
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
assert not collections
|
assert not collections
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,7 @@ class FilesystemStorage(Storage):
|
||||||
raise TypeError('collection argument must not be given.')
|
raise TypeError('collection argument must not be given.')
|
||||||
for collection in os.listdir(path):
|
for collection in os.listdir(path):
|
||||||
s = cls(path=path, collection=collection, **kwargs)
|
s = cls(path=path, collection=collection, **kwargs)
|
||||||
if next(s.list(), None) is not None:
|
yield s
|
||||||
yield s
|
|
||||||
|
|
||||||
def _get_filepath(self, href):
|
def _get_filepath(self, href):
|
||||||
return os.path.join(self.path, href)
|
return os.path.join(self.path, href)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue