Test authorization
This commit is contained in:
parent
e25373fa85
commit
9d2743d797
@ -19,6 +19,7 @@ Radicale tests with simple requests.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import base64
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import posixpath
|
import posixpath
|
||||||
@ -733,6 +734,20 @@ class BaseRequestsMixIn:
|
|||||||
assert "href>/calendar.ics/journal1.ics</" not in answer
|
assert "href>/calendar.ics/journal1.ics</" not in answer
|
||||||
assert "href>/calendar.ics/journal2.ics</" not in answer
|
assert "href>/calendar.ics/journal2.ics</" not in answer
|
||||||
|
|
||||||
|
def test_authorization(self):
|
||||||
|
authorization = "Basic " + base64.b64encode(b"user:").decode()
|
||||||
|
status, headers, answer = self.request(
|
||||||
|
"PROPFIND", "/",
|
||||||
|
"""<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<propfind xmlns="DAV:">
|
||||||
|
<prop>
|
||||||
|
<current-user-principal />
|
||||||
|
</prop>
|
||||||
|
</propfind>""",
|
||||||
|
HTTP_AUTHORIZATION=authorization)
|
||||||
|
assert status == 207
|
||||||
|
assert "href>/user/<" in answer
|
||||||
|
|
||||||
def test_principal_collection_creation(self):
|
def test_principal_collection_creation(self):
|
||||||
"""Verify existence of the principal collection."""
|
"""Verify existence of the principal collection."""
|
||||||
status, headers, answer = self.request(
|
status, headers, answer = self.request(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user