sharing: test cases for fix Content-Disposition for share
This commit is contained in:
@@ -903,6 +903,8 @@ class TestSharingApiSanity(BaseTest):
|
|||||||
"collection_by_map": "True",
|
"collection_by_map": "True",
|
||||||
"collection_by_token": "True"},
|
"collection_by_token": "True"},
|
||||||
"logging": {"request_header_on_debug": "False",
|
"logging": {"request_header_on_debug": "False",
|
||||||
|
"response_header_on_debug": "True",
|
||||||
|
"response_content_on_debug": "True",
|
||||||
"request_content_on_debug": "False"},
|
"request_content_on_debug": "False"},
|
||||||
"rights": {"type": "owner_only"}})
|
"rights": {"type": "owner_only"}})
|
||||||
|
|
||||||
@@ -983,6 +985,9 @@ class TestSharingApiSanity(BaseTest):
|
|||||||
logging.info("\n*** fetch collection (with credentials) as owner")
|
logging.info("\n*** fetch collection (with credentials) as owner")
|
||||||
_, headers, answer = self.request("GET", path_mapped, check=200, login="owner:ownerpw")
|
_, headers, answer = self.request("GET", path_mapped, check=200, login="owner:ownerpw")
|
||||||
assert "UID:event" in answer
|
assert "UID:event" in answer
|
||||||
|
assert 'Content-Disposition' in headers
|
||||||
|
# fallback title
|
||||||
|
assert 'Calendar.ics' in headers['Content-Disposition']
|
||||||
|
|
||||||
logging.info("\n*** fetch item (with credentials) as owner")
|
logging.info("\n*** fetch item (with credentials) as owner")
|
||||||
_, headers, answer = self.request("GET", path_mapped_item1, check=200, login="owner:ownerpw")
|
_, headers, answer = self.request("GET", path_mapped_item1, check=200, login="owner:ownerpw")
|
||||||
@@ -995,6 +1000,9 @@ class TestSharingApiSanity(BaseTest):
|
|||||||
_, headers, answer = self.request("GET", path_shared, check=200, login="user:userpw")
|
_, headers, answer = self.request("GET", path_shared, check=200, login="user:userpw")
|
||||||
assert "UID:event1" in answer
|
assert "UID:event1" in answer
|
||||||
assert "UID:event2" in answer
|
assert "UID:event2" in answer
|
||||||
|
assert 'Content-Disposition' in headers
|
||||||
|
# title from Properties
|
||||||
|
assert 'Test.ics' in headers['Content-Disposition']
|
||||||
|
|
||||||
logging.info("\n*** fetch item via map (with credentials) as user")
|
logging.info("\n*** fetch item via map (with credentials) as user")
|
||||||
_, headers, answer = self.request("GET", path_shared_item1, check=200, login="user:userpw")
|
_, headers, answer = self.request("GET", path_shared_item1, check=200, login="user:userpw")
|
||||||
@@ -4197,6 +4205,7 @@ permissions: RrWw""")
|
|||||||
"collection_by_bday": "True"},
|
"collection_by_bday": "True"},
|
||||||
"logging": {"request_header_on_debug": "False",
|
"logging": {"request_header_on_debug": "False",
|
||||||
"response_content_on_debug": "True",
|
"response_content_on_debug": "True",
|
||||||
|
"response_header_on_debug": "True",
|
||||||
"request_content_on_debug": "True"},
|
"request_content_on_debug": "True"},
|
||||||
"rights": {"type": "owner_only"}})
|
"rights": {"type": "owner_only"}})
|
||||||
|
|
||||||
@@ -4238,9 +4247,12 @@ permissions: RrWw""")
|
|||||||
|
|
||||||
# execute GET as owner
|
# execute GET as owner
|
||||||
logging.info("\n*** GET VCF collection owner -> ok")
|
logging.info("\n*** GET VCF collection owner -> ok")
|
||||||
_, answer = self.get(path_mapped, login="owner:ownerpw")
|
_, headers, answer = self.request("GET", path_mapped, login="owner:ownerpw")
|
||||||
assert "contact1" in answer
|
assert "contact1" in answer
|
||||||
assert "contact2" in answer
|
assert "contact2" in answer
|
||||||
|
assert 'Content-Disposition' in headers
|
||||||
|
# title from fallback
|
||||||
|
assert 'Address%20book.vcf' in headers['Content-Disposition']
|
||||||
|
|
||||||
# create map
|
# create map
|
||||||
logging.info("\n*** create bday user/owner:r -> ok")
|
logging.info("\n*** create bday user/owner:r -> ok")
|
||||||
@@ -4251,6 +4263,7 @@ permissions: RrWw""")
|
|||||||
json_dict['Permissions'] = "r"
|
json_dict['Permissions'] = "r"
|
||||||
json_dict['Enabled'] = True
|
json_dict['Enabled'] = True
|
||||||
json_dict['Hidden'] = False
|
json_dict['Hidden'] = False
|
||||||
|
json_dict['Properties'] = {"D:displayname": "Test-BDAY"}
|
||||||
_, headers, answer = self._sharing_api_json("bday", "create", check=200, login="owner:ownerpw", json_dict=json_dict)
|
_, headers, answer = self._sharing_api_json("bday", "create", check=200, login="owner:ownerpw", json_dict=json_dict)
|
||||||
answer_dict = json.loads(answer)
|
answer_dict = json.loads(answer)
|
||||||
assert answer_dict['Status'] == "success"
|
assert answer_dict['Status'] == "success"
|
||||||
@@ -4283,7 +4296,7 @@ permissions: RrWw""")
|
|||||||
|
|
||||||
# verify content as user
|
# verify content as user
|
||||||
logging.info("\n*** GET collection user -> ok")
|
logging.info("\n*** GET collection user -> ok")
|
||||||
_, answer = self.get(path_shared_r, login="user:userpw")
|
_, headers, answer = self.request("GET", path_shared_r, login="user:userpw")
|
||||||
assert "BEGIN:VCARD" not in answer
|
assert "BEGIN:VCARD" not in answer
|
||||||
assert "BEGIN:VCALENDAR" in answer
|
assert "BEGIN:VCALENDAR" in answer
|
||||||
assert "RRULE:FREQ=YEARLY" in answer
|
assert "RRULE:FREQ=YEARLY" in answer
|
||||||
@@ -4291,6 +4304,12 @@ permissions: RrWw""")
|
|||||||
assert "DTEND;VALUE=DATE:19700102" in answer
|
assert "DTEND;VALUE=DATE:19700102" in answer
|
||||||
assert "TRANSP:TRANSPARENT" in answer
|
assert "TRANSP:TRANSPARENT" in answer
|
||||||
assert "DESCRIPTION:BDAY=1970-01-01" in answer
|
assert "DESCRIPTION:BDAY=1970-01-01" in answer
|
||||||
|
# content type must be adjusted
|
||||||
|
assert 'Content-Type' in headers
|
||||||
|
assert 'text/calendar' in headers['Content-Type']
|
||||||
|
# title from Properties
|
||||||
|
assert 'Content-Disposition' in headers
|
||||||
|
assert 'Test-BDAY.ics' in headers['Content-Disposition']
|
||||||
|
|
||||||
# verify report as user
|
# verify report as user
|
||||||
logging.info("\n*** REPORT collection user -> ok")
|
logging.info("\n*** REPORT collection user -> ok")
|
||||||
|
|||||||
Reference in New Issue
Block a user