Type hints for tests
This commit is contained in:
@@ -28,7 +28,8 @@ from radicale import auth
|
||||
|
||||
|
||||
class Auth(auth.BaseAuth):
|
||||
def login(self, login, password):
|
||||
|
||||
def login(self, login: str, password: str) -> str:
|
||||
if login == "tmp":
|
||||
return login
|
||||
return ""
|
||||
|
||||
@@ -23,7 +23,8 @@ from radicale import pathutils, rights
|
||||
|
||||
|
||||
class Rights(rights.BaseRights):
|
||||
def authorization(self, user, path):
|
||||
|
||||
def authorization(self, user: str, path: str) -> str:
|
||||
sane_path = pathutils.strip_path(path)
|
||||
if sane_path not in ("tmp", "other"):
|
||||
return ""
|
||||
|
||||
@@ -27,8 +27,10 @@ from radicale.storage import BaseCollection, multifilesystem
|
||||
|
||||
|
||||
class Collection(multifilesystem.Collection):
|
||||
|
||||
sync = BaseCollection.sync
|
||||
|
||||
|
||||
class Storage(multifilesystem.Storage):
|
||||
|
||||
_collection_class = Collection
|
||||
|
||||
@@ -21,13 +21,16 @@ Custom web plugin.
|
||||
|
||||
from http import client
|
||||
|
||||
from radicale import httputils, web
|
||||
from radicale import httputils, types, web
|
||||
|
||||
|
||||
class Web(web.BaseWeb):
|
||||
def get(self, environ, base_prefix, path, user):
|
||||
|
||||
def get(self, environ: types.WSGIEnviron, base_prefix: str, path: str,
|
||||
user: str) -> types.WSGIResponse:
|
||||
return client.OK, {"Content-Type": "text/plain"}, "custom"
|
||||
|
||||
def post(self, environ, base_prefix, path, user):
|
||||
def post(self, environ: types.WSGIEnviron, base_prefix: str, path: str,
|
||||
user: str) -> types.WSGIResponse:
|
||||
content = httputils.read_request_body(self.configuration, environ)
|
||||
return client.OK, {"Content-Type": "text/plain"}, "echo:" + content
|
||||
|
||||
Reference in New Issue
Block a user