1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-10 18:40:53 +00:00

Remove duplicated code

This commit is contained in:
Unrud 2020-04-22 19:20:36 +02:00
parent d73a308294
commit 9bd852ba5e
4 changed files with 19 additions and 25 deletions

View file

@ -21,7 +21,6 @@ Radicale tests with simple requests and authentication.
"""
import base64
import os
import shutil
import tempfile
@ -85,8 +84,7 @@ class TestBaseAuthRequests(BaseTest):
("", "🔑", False), ("", "", False))
for user, password, valid in test_matrix:
self.propfind("/", check=207 if valid else 401,
HTTP_AUTHORIZATION=("Basic %s" % base64.b64encode(
("%s:%s" % (user, password)).encode()).decode()))
login="%s:%s" % (user, password))
def test_htpasswd_plain(self):
self._test_htpasswd("plain", "tmp:bepo")
@ -165,5 +163,4 @@ class TestBaseAuthRequests(BaseTest):
self.configuration.update(
{"auth": {"type": "radicale.tests.custom.auth"}}, "test")
self.application = Application(self.configuration)
self.propfind("/tmp/", HTTP_AUTHORIZATION="Basic %s" %
base64.b64encode(("tmp:").encode()).decode())
self.propfind("/tmp/", login="tmp:")