Tests: Use absolute imports
This commit is contained in:
parent
428e4be0b8
commit
ed72e697de
@ -48,8 +48,6 @@ def finish_request_cov(self, request, client_address):
|
|||||||
|
|
||||||
server.ParallelHTTPServer.finish_request = finish_request_cov
|
server.ParallelHTTPServer.finish_request = finish_request_cov
|
||||||
|
|
||||||
# Allow importing of tests.custom....
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
|
||||||
# Enable debug output
|
# Enable debug output
|
||||||
radicale.log.logger.setLevel(logging.DEBUG)
|
radicale.log.logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
@ -29,8 +29,7 @@ import tempfile
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from radicale import Application, config
|
from radicale import Application, config
|
||||||
|
from radicale.tests.test_base import BaseTest
|
||||||
from .test_base import BaseTest
|
|
||||||
|
|
||||||
|
|
||||||
class TestBaseAuthRequests(BaseTest):
|
class TestBaseAuthRequests(BaseTest):
|
||||||
@ -162,7 +161,7 @@ class TestBaseAuthRequests(BaseTest):
|
|||||||
def test_custom(self):
|
def test_custom(self):
|
||||||
"""Custom authentication."""
|
"""Custom authentication."""
|
||||||
self.configuration.update(
|
self.configuration.update(
|
||||||
{"auth": {"type": "tests.custom.auth"}}, "test")
|
{"auth": {"type": "radicale.tests.custom.auth"}}, "test")
|
||||||
self.application = Application(self.configuration)
|
self.application = Application(self.configuration)
|
||||||
status, _, answer = self.request(
|
status, _, answer = self.request(
|
||||||
"PROPFIND", "/tmp", HTTP_AUTHORIZATION="Basic %s" %
|
"PROPFIND", "/tmp", HTTP_AUTHORIZATION="Basic %s" %
|
||||||
|
@ -32,9 +32,8 @@ from functools import partial
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from radicale import Application, config, storage
|
from radicale import Application, config, storage
|
||||||
|
from radicale.tests import BaseTest
|
||||||
from . import BaseTest
|
from radicale.tests.helpers import get_file_content
|
||||||
from .helpers import get_file_content
|
|
||||||
|
|
||||||
|
|
||||||
class BaseRequestsMixIn:
|
class BaseRequestsMixIn:
|
||||||
@ -1632,7 +1631,7 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
|
|||||||
|
|
||||||
class TestCustomStorageSystem(BaseFileSystemTest):
|
class TestCustomStorageSystem(BaseFileSystemTest):
|
||||||
"""Test custom backend loading."""
|
"""Test custom backend loading."""
|
||||||
storage_type = "tests.custom.storage_simple_sync"
|
storage_type = "radicale.tests.custom.storage_simple_sync"
|
||||||
full_sync_token_support = False
|
full_sync_token_support = False
|
||||||
_report_sync_token = BaseRequestsMixIn._report_sync_token
|
_report_sync_token = BaseRequestsMixIn._report_sync_token
|
||||||
test_root = BaseRequestsMixIn.test_root
|
test_root = BaseRequestsMixIn.test_root
|
||||||
|
@ -22,8 +22,7 @@ from configparser import RawConfigParser
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from radicale import config
|
from radicale import config
|
||||||
|
from radicale.tests.helpers import configuration_to_dict
|
||||||
from .helpers import configuration_to_dict
|
|
||||||
|
|
||||||
|
|
||||||
class TestConfig:
|
class TestConfig:
|
||||||
|
@ -24,9 +24,8 @@ import shutil
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from radicale import Application, config
|
from radicale import Application, config
|
||||||
|
from radicale.tests.helpers import get_file_content
|
||||||
from .helpers import get_file_content
|
from radicale.tests.test_base import BaseTest
|
||||||
from .test_base import BaseTest
|
|
||||||
|
|
||||||
|
|
||||||
class TestBaseRightsRequests(BaseTest):
|
class TestBaseRightsRequests(BaseTest):
|
||||||
@ -144,8 +143,8 @@ permissions: Rr""")
|
|||||||
|
|
||||||
def test_custom(self):
|
def test_custom(self):
|
||||||
"""Custom rights management."""
|
"""Custom rights management."""
|
||||||
self._test_rights("tests.custom.rights", "", "/", "r", 401)
|
self._test_rights("radicale.tests.custom.rights", "", "/", "r", 401)
|
||||||
self._test_rights("tests.custom.rights", "", "/tmp", "r", 207)
|
self._test_rights("radicale.tests.custom.rights", "", "/tmp", "r", 207)
|
||||||
|
|
||||||
def test_collections_and_items(self):
|
def test_collections_and_items(self):
|
||||||
"""Test rights for creation of collections, calendars and items.
|
"""Test rights for creation of collections, calendars and items.
|
||||||
|
@ -35,8 +35,7 @@ from urllib.error import HTTPError, URLError
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from radicale import config, server
|
from radicale import config, server
|
||||||
|
from radicale.tests.helpers import configuration_to_dict, get_file_path
|
||||||
from .helpers import configuration_to_dict, get_file_path
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gunicorn
|
import gunicorn
|
||||||
|
@ -23,8 +23,7 @@ import shutil
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from radicale import Application, config
|
from radicale import Application, config
|
||||||
|
from radicale.tests.test_base import BaseTest
|
||||||
from .test_base import BaseTest
|
|
||||||
|
|
||||||
|
|
||||||
class TestBaseWebRequests(BaseTest):
|
class TestBaseWebRequests(BaseTest):
|
||||||
@ -62,7 +61,7 @@ class TestBaseWebRequests(BaseTest):
|
|||||||
def test_custom(self):
|
def test_custom(self):
|
||||||
"""Custom web plugin."""
|
"""Custom web plugin."""
|
||||||
self.configuration.update({
|
self.configuration.update({
|
||||||
"web": {"type": "tests.custom.web"}}, "test")
|
"web": {"type": "radicale.tests.custom.web"}}, "test")
|
||||||
self.application = Application(self.configuration)
|
self.application = Application(self.configuration)
|
||||||
status, _, answer = self.request("GET", "/.web")
|
status, _, answer = self.request("GET", "/.web")
|
||||||
assert status == 200
|
assert status == 200
|
||||||
|
Loading…
Reference in New Issue
Block a user