Loosen up tests again...

We shouldn't test item uploading functions in discovery
This commit is contained in:
Markus Unterwaditzer 2014-03-29 13:27:34 +01:00
parent fe1d141b34
commit 36c0607b45
2 changed files with 4 additions and 10 deletions

View file

@ -98,7 +98,7 @@ class StorageTests(object):
assert list(s.list())
def test_discover(self):
collections = {}
collections = set()
def main():
for i in range(1, 5):
@ -108,9 +108,7 @@ class StorageTests(object):
i += 1
s = self.storage_class(
**self.get_storage_args(collection=collection))
item = self._create_bogus_item(str(i))
s.upload(item)
collections[s.collection] = normalize_item(item)
collections.add(s.collection)
main() # remove leftover variables from loop for safety
d = self.storage_class.discover(
@ -124,10 +122,7 @@ class StorageTests(object):
# collections, as they are not relevant to us.
print('Skipping {}'.format(s.collection))
continue
((href, etag),) = s.list()
item, etag = s.get(href)
assert collections[s.collection] == normalize_item(item)
del collections[s.collection]
collections.remove(s.collection)
main()
assert not collections

View file

@ -49,8 +49,7 @@ class FilesystemStorage(Storage):
raise TypeError('collection argument must not be given.')
for collection in os.listdir(path):
s = cls(path=path, collection=collection, **kwargs)
if next(s.list(), None) is not None:
yield s
yield s
def _get_filepath(self, href):
return os.path.join(self.path, href)