mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Remove unittest inheritance
This commit is contained in:
parent
12c70ca573
commit
17f9ccc895
7 changed files with 19 additions and 18 deletions
|
|
@ -11,6 +11,7 @@ from vdirsyncer.storage.base import Item
|
|||
import vdirsyncer.exceptions as exceptions
|
||||
from .. import assert_item_equals
|
||||
import random
|
||||
import pytest
|
||||
|
||||
|
||||
class StorageTests(object):
|
||||
|
|
@ -47,7 +48,8 @@ class StorageTests(object):
|
|||
s = self._get_storage()
|
||||
item = self._create_bogus_item(1)
|
||||
s.upload(item)
|
||||
self.assertRaises(exceptions.PreconditionFailed, s.upload, item)
|
||||
with pytest.raises(exceptions.PreconditionFailed):
|
||||
s.upload(item)
|
||||
|
||||
def test_upload(self):
|
||||
s = self._get_storage()
|
||||
|
|
@ -68,23 +70,24 @@ class StorageTests(object):
|
|||
def test_update_nonexisting(self):
|
||||
s = self._get_storage()
|
||||
item = self._create_bogus_item(1)
|
||||
self.assertRaises(exceptions.PreconditionFailed,
|
||||
s.update, s._get_href('1'), item, 123)
|
||||
self.assertRaises(exceptions.PreconditionFailed,
|
||||
s.update, 'huehue', item, 123)
|
||||
with pytest.raises(exceptions.PreconditionFailed):
|
||||
s.update(s._get_href('1'), item, 123)
|
||||
with pytest.raises(exceptions.PreconditionFailed):
|
||||
s.update('huehue', item, 123)
|
||||
|
||||
def test_wrong_etag(self):
|
||||
s = self._get_storage()
|
||||
obj = self._create_bogus_item(1)
|
||||
href, etag = s.upload(obj)
|
||||
self.assertRaises(
|
||||
exceptions.PreconditionFailed, s.update, href, obj, 'lolnope')
|
||||
self.assertRaises(
|
||||
exceptions.PreconditionFailed, s.delete, href, 'lolnope')
|
||||
with pytest.raises(exceptions.PreconditionFailed):
|
||||
s.update(href, obj, 'lolnope')
|
||||
with pytest.raises(exceptions.PreconditionFailed):
|
||||
s.delete(href, 'lolnope')
|
||||
|
||||
def test_delete_nonexisting(self):
|
||||
s = self._get_storage()
|
||||
self.assertRaises(exceptions.PreconditionFailed, s.delete, '1', 123)
|
||||
with pytest.raises(exceptions.PreconditionFailed):
|
||||
s.delete('1', 123)
|
||||
|
||||
def test_list(self):
|
||||
s = self._get_storage()
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ END:VEVENT
|
|||
END:VCALENDAR'''
|
||||
|
||||
|
||||
class CaldavStorageTests(TestCase, DavStorageTests):
|
||||
class TestCaldavStorage(DavStorageTests):
|
||||
storage_class = CaldavStorage
|
||||
|
||||
item_template = TASK_TEMPLATE
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from vdirsyncer.storage.dav.carddav import CarddavStorage
|
|||
from . import DavStorageTests
|
||||
|
||||
|
||||
class CarddavStorageTests(TestCase, DavStorageTests):
|
||||
class TestCarddavStorage(DavStorageTests):
|
||||
storage_class = CarddavStorage
|
||||
|
||||
item_template = (u'BEGIN:VCARD\n'
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
:license: MIT, see LICENSE for more details.
|
||||
'''
|
||||
|
||||
from unittest import TestCase
|
||||
import pytest
|
||||
import os
|
||||
from vdirsyncer.storage.filesystem import FilesystemStorage
|
||||
|
|
@ -16,7 +15,7 @@ from . import StorageTests
|
|||
|
||||
|
||||
@pytest.mark.usefixtures('class_tmpdir')
|
||||
class FilesystemStorageTests(TestCase, StorageTests):
|
||||
class TestFilesystemStorage(StorageTests):
|
||||
storage_class = FilesystemStorage
|
||||
|
||||
def get_storage_args(self, collection=None):
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from textwrap import dedent
|
|||
from vdirsyncer.storage.http import HttpStorage, Item
|
||||
|
||||
|
||||
class HttpStorageTests(TestCase):
|
||||
class TestHttpStorage(object):
|
||||
|
||||
def test_list(self):
|
||||
collection_url = 'http://127.0.0.1/calendar/collection/'
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from vdirsyncer.storage.memory import MemoryStorage
|
|||
from . import StorageTests
|
||||
|
||||
|
||||
class MemoryStorageTests(TestCase, StorageTests):
|
||||
class TestMemoryStorage(StorageTests):
|
||||
|
||||
storage_class = MemoryStorage
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@
|
|||
:license: MIT, see LICENSE for more details.
|
||||
'''
|
||||
|
||||
from unittest import TestCase
|
||||
import vdirsyncer.cli as cli
|
||||
import vdirsyncer.exceptions as exceptions
|
||||
|
||||
|
||||
class CliTests(TestCase):
|
||||
class TestCli(object):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue