sharing/test: per db extension
This commit is contained in:
@@ -76,24 +76,55 @@ class TestSharingApiSanity(BaseTest):
|
||||
# disabled
|
||||
for path in ["/.sharing", "/.sharing/"]:
|
||||
_, headers, _ = self.request("POST", path, check=404)
|
||||
# enabled (permutations)
|
||||
|
||||
path = "/.sharing/"
|
||||
|
||||
# no database is active
|
||||
logging.info("\n*** check API hook base: map=True token=False")
|
||||
self.configure({"sharing": {
|
||||
"collection_by_map": "True",
|
||||
"collection_by_token": "False"}
|
||||
})
|
||||
path = "/.sharing/"
|
||||
_, headers, _ = self.request("POST", path, check=401)
|
||||
_, headers, _ = self.request("POST", path, check=404)
|
||||
|
||||
logging.info("\n*** check API hook base: map=False token=True")
|
||||
self.configure({"sharing": {
|
||||
"collection_by_map": "False",
|
||||
"collection_by_token": "True"}
|
||||
})
|
||||
path = "/.sharing/"
|
||||
_, headers, _ = self.request("POST", path, check=401)
|
||||
_, headers, _ = self.request("POST", path, check=404)
|
||||
|
||||
logging.info("\n*** check API hook base: map=True token=True")
|
||||
self.configure({"sharing": {
|
||||
"collection_by_map": "True",
|
||||
"collection_by_token": "True"}
|
||||
})
|
||||
_, headers, _ = self.request("POST", path, check=404)
|
||||
|
||||
for db_type in list(filter(lambda item: item != "none", sharing.INTERNAL_TYPES)):
|
||||
logging.info("\n*** test: %s", db_type)
|
||||
self.configure({"sharing": {"type": db_type}})
|
||||
|
||||
# no database is active
|
||||
logging.info("\n*** check API hook base: map=True token=False")
|
||||
self.configure({"sharing": {
|
||||
"collection_by_map": "True",
|
||||
"collection_by_token": "False"}
|
||||
})
|
||||
_, headers, _ = self.request("POST", path, check=401)
|
||||
|
||||
logging.info("\n*** check API hook base: map=False token=True")
|
||||
self.configure({"sharing": {
|
||||
"collection_by_map": "False",
|
||||
"collection_by_token": "True"}
|
||||
})
|
||||
_, headers, _ = self.request("POST", path, check=401)
|
||||
|
||||
logging.info("\n*** check API hook base: map=True token=True")
|
||||
self.configure({"sharing": {
|
||||
"collection_by_map": "True",
|
||||
"collection_by_token": "True"}
|
||||
})
|
||||
path = "/.sharing/"
|
||||
_, headers, _ = self.request("POST", path, check=401)
|
||||
|
||||
def test_sharing_api_base_with_auth(self) -> None:
|
||||
@@ -108,12 +139,17 @@ class TestSharingApiSanity(BaseTest):
|
||||
|
||||
json_dict: dict
|
||||
|
||||
# path with no valid API hook
|
||||
for db_type in list(filter(lambda item: item != "none", sharing.INTERNAL_TYPES)):
|
||||
logging.info("\n*** test: %s", db_type)
|
||||
self.configure({"sharing": {"type": db_type}})
|
||||
|
||||
for path in ["/.sharing/", "/.sharing/v9/"]:
|
||||
logging.info("\n*** check invalid API URI: %r", path)
|
||||
_, headers, _ = self.request("POST", path, check=404, login="owner:ownerpw")
|
||||
|
||||
# path with valid API but no hook
|
||||
for path in ["/.sharing/v1/"]:
|
||||
logging.info("\n*** check valid API URI without hook: %r", path)
|
||||
_, headers, _ = self.request("POST", path, check=404, login="owner:ownerpw")
|
||||
|
||||
# path with valid API and hook but not enabled "map"
|
||||
@@ -124,6 +160,7 @@ class TestSharingApiSanity(BaseTest):
|
||||
sharetype = "map"
|
||||
for action in sharing.API_HOOKS_V1:
|
||||
path = "/.sharing/v1/" + sharetype + "/" + action
|
||||
logging.info("\n*** check valid API URI hook (but not enabled): %r", path)
|
||||
_, headers, _ = self.request("POST", path, check=404, login="owner:ownerpw")
|
||||
|
||||
# path with valid API and hook but not enabled "token"
|
||||
@@ -134,6 +171,7 @@ class TestSharingApiSanity(BaseTest):
|
||||
sharetype = "token"
|
||||
for action in sharing.API_HOOKS_V1:
|
||||
path = "/.sharing/v1/" + sharetype + "/" + action
|
||||
logging.info("\n*** check valid API URI hook (but not enabled): %r", path)
|
||||
_, headers, _ = self.request("POST", path, check=404, login="owner:ownerpw")
|
||||
|
||||
# check info hook
|
||||
|
||||
Reference in New Issue
Block a user