mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-15 20:36:55 +00:00
More type hints
This commit is contained in:
parent
11f7559ef3
commit
c93d7b8715
51 changed files with 1374 additions and 957 deletions
|
@ -119,7 +119,7 @@ class BaseTest:
|
|||
if not self._check_status(status, 207, check):
|
||||
return status, None
|
||||
responses = self.parse_responses(answer)
|
||||
if args.get("HTTP_DEPTH", 0) == 0:
|
||||
if args.get("HTTP_DEPTH", "0") == "0":
|
||||
assert len(responses) == 1 and path in responses
|
||||
return status, responses
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ Radicale tests with simple requests and authentication.
|
|||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
@ -114,7 +115,7 @@ class TestBaseAuthRequests(BaseTest):
|
|||
def test_htpasswd_multi(self):
|
||||
self._test_htpasswd("plain", "ign:ign\ntmp:bepo")
|
||||
|
||||
@pytest.mark.skipif(os.name == "nt", reason="leading and trailing "
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="leading and trailing "
|
||||
"whitespaces not allowed in file names")
|
||||
def test_htpasswd_whitespace_user(self):
|
||||
for user in (" tmp", "tmp ", " tmp "):
|
||||
|
|
|
@ -391,10 +391,10 @@ class BaseRequestsMixIn:
|
|||
event = get_file_content("event1.ics")
|
||||
event_path = posixpath.join(calendar_path, "event.ics")
|
||||
self.put(event_path, event)
|
||||
_, responses = self.propfind("/", HTTP_DEPTH=1)
|
||||
_, responses = self.propfind("/", HTTP_DEPTH="1")
|
||||
assert len(responses) == 2
|
||||
assert "/" in responses and calendar_path in responses
|
||||
_, responses = self.propfind(calendar_path, HTTP_DEPTH=1)
|
||||
_, responses = self.propfind(calendar_path, HTTP_DEPTH="1")
|
||||
assert len(responses) == 2
|
||||
assert calendar_path in responses and event_path in responses
|
||||
|
||||
|
@ -1653,8 +1653,8 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
|
|||
assert answer1 == answer2
|
||||
assert os.path.exists(os.path.join(cache_folder, "event1.ics"))
|
||||
|
||||
@pytest.mark.skipif(os.name not in ("nt", "posix"),
|
||||
reason="Only supported on 'nt' and 'posix'")
|
||||
@pytest.mark.skipif(os.name != "posix" and sys.platform != "win32",
|
||||
reason="Only supported on 'posix' and 'win32'")
|
||||
def test_put_whole_calendar_uids_used_as_file_names(self):
|
||||
"""Test if UIDs are used as file names."""
|
||||
BaseRequestsMixIn.test_put_whole_calendar(self)
|
||||
|
@ -1662,8 +1662,8 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
|
|||
_, answer = self.get("/calendar.ics/%s.ics" % uid)
|
||||
assert "\r\nUID:%s\r\n" % uid in answer
|
||||
|
||||
@pytest.mark.skipif(os.name not in ("nt", "posix"),
|
||||
reason="Only supported on 'nt' and 'posix'")
|
||||
@pytest.mark.skipif(os.name != "posix" and sys.platform != "win32",
|
||||
reason="Only supported on 'posix' and 'win32'")
|
||||
def test_put_whole_calendar_random_uids_used_as_file_names(self):
|
||||
"""Test if UIDs are used as file names."""
|
||||
BaseRequestsMixIn.test_put_whole_calendar_without_uids(self)
|
||||
|
@ -1676,8 +1676,8 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
|
|||
_, answer = self.get("/calendar.ics/%s.ics" % uid)
|
||||
assert "\r\nUID:%s\r\n" % uid in answer
|
||||
|
||||
@pytest.mark.skipif(os.name not in ("nt", "posix"),
|
||||
reason="Only supported on 'nt' and 'posix'")
|
||||
@pytest.mark.skipif(os.name != "posix" and sys.platform != "win32",
|
||||
reason="Only supported on 'posix' and 'win32'")
|
||||
def test_put_whole_addressbook_uids_used_as_file_names(self):
|
||||
"""Test if UIDs are used as file names."""
|
||||
BaseRequestsMixIn.test_put_whole_addressbook(self)
|
||||
|
@ -1685,8 +1685,8 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
|
|||
_, answer = self.get("/contacts.vcf/%s.vcf" % uid)
|
||||
assert "\r\nUID:%s\r\n" % uid in answer
|
||||
|
||||
@pytest.mark.skipif(os.name not in ("nt", "posix"),
|
||||
reason="Only supported on 'nt' and 'posix'")
|
||||
@pytest.mark.skipif(os.name != "posix" and sys.platform != "win32",
|
||||
reason="Only supported on 'posix' and 'win32'")
|
||||
def test_put_whole_addressbook_random_uids_used_as_file_names(self):
|
||||
"""Test if UIDs are used as file names."""
|
||||
BaseRequestsMixIn.test_put_whole_addressbook_without_uids(self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue