Merge pull request #2150 from pbiering/sharing-info-bday
Sharing/show supported Actions on info
This commit is contained in:
26
SHARING.md
26
SHARING.md
@@ -270,7 +270,8 @@ FeatureEnabledCollectionByToken=True
|
||||
PermittedCreateCollectionByToken=True
|
||||
SupportedConversions=(bday none)
|
||||
PermittedPropertiesOverlay=True
|
||||
SupportedPropertiesOverlay=(C:calendar-description ICAL:calendar-color CR:addressbook-description INF:addressbook-color D:displayname)
|
||||
SupportedPropertiesOverlay=(C:calendar-description ICAL:calendar-color CR:addressbook-description INF:addressbook-color D:displayname ICAL:calendar-order)
|
||||
SupportedActions='{'config': {'conversion_bday_summary_template': 'str', 'conversion_bday_description_template': 'str', 'conversion_bday_alarm_trigger_template': 'str', 'conversion_bday_categories': 'str', 'conversion_bday_age_max': 'int'}}'
|
||||
```
|
||||
|
||||
###### json->json, parsed with jq
|
||||
@@ -285,9 +286,28 @@ curl -u user:$userpw --silent -H "accept: application/json" -d "" http://localho
|
||||
"PermittedCreateCollectionByMap": true,
|
||||
"FeatureEnabledCollectionByToken": true,
|
||||
"PermittedCreateCollectionByToken": true,
|
||||
"SupportedConversions": ["bday", "none"],
|
||||
"SupportedConversions": [
|
||||
"bday",
|
||||
"none"
|
||||
],
|
||||
"PermittedPropertiesOverlay": true,
|
||||
"SupportedPropertiesOverlay": ["C:calendar-description", "ICAL:calendar-color", "CR:addressbook-description", "INF:addressbook-color", "D:displayname"]
|
||||
"SupportedPropertiesOverlay": [
|
||||
"C:calendar-description",
|
||||
"ICAL:calendar-color",
|
||||
"CR:addressbook-description",
|
||||
"INF:addressbook-color",
|
||||
"D:displayname",
|
||||
"ICAL:calendar-order"
|
||||
],
|
||||
"SupportedActions": {
|
||||
"config": {
|
||||
"conversion_bday_summary_template": "str",
|
||||
"conversion_bday_description_template": "str",
|
||||
"conversion_bday_alarm_trigger_template": "str",
|
||||
"conversion_bday_categories": "str",
|
||||
"conversion_bday_age_max": "int"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ API_TYPES_V1: dict[str, type] = {
|
||||
"SupportedConversions": list,
|
||||
"PermittedPropertiesOverlay": bool,
|
||||
"SupportedPropertiesOverlay": list,
|
||||
"SupportedActions": dict,
|
||||
}
|
||||
|
||||
|
||||
@@ -185,6 +186,7 @@ def check_template_alarm_trigger(data: Any) -> str:
|
||||
return data
|
||||
|
||||
|
||||
# dict for validation of API request: create/update
|
||||
ACTIONS_WHITELIST: dict = {
|
||||
'config': {
|
||||
'conversion_bday_summary_template': check_template_not_empty,
|
||||
@@ -195,6 +197,17 @@ ACTIONS_WHITELIST: dict = {
|
||||
},
|
||||
}
|
||||
|
||||
# dict for displaying API request: info
|
||||
ACTIONS_WHITELIST_INFO: dict = {
|
||||
'config': {
|
||||
'conversion_bday_summary_template': "str",
|
||||
'conversion_bday_description_template': "str",
|
||||
'conversion_bday_alarm_trigger_template': "str",
|
||||
'conversion_bday_categories': "str",
|
||||
'conversion_bday_age_max': "int",
|
||||
},
|
||||
}
|
||||
|
||||
CONVERSIONS_WHITELIST: Sequence[str] = ("bday", "none")
|
||||
|
||||
|
||||
@@ -1431,6 +1444,7 @@ class BaseSharing:
|
||||
answer['SupportedConversions'] = CONVERSIONS_WHITELIST
|
||||
answer['PermittedPropertiesOverlay'] = self.permit_properties_overlay
|
||||
answer['SupportedPropertiesOverlay'] = OVERLAY_PROPERTIES_WHITELIST
|
||||
answer['SupportedActions'] = ACTIONS_WHITELIST_INFO
|
||||
|
||||
# action: TOGGLE
|
||||
elif action in API_SHARE_TOGGLES_V1:
|
||||
|
||||
@@ -425,6 +425,7 @@ class TestSharingApiSanity(BaseTest):
|
||||
assert answer_dict['SupportedConversions'] == list(sharing.CONVERSIONS_WHITELIST)
|
||||
assert answer_dict['PermittedPropertiesOverlay'] is True
|
||||
assert answer_dict['SupportedPropertiesOverlay'] == list(sharing.OVERLAY_PROPERTIES_WHITELIST)
|
||||
assert answer_dict['SupportedActions'] == sharing.ACTIONS_WHITELIST_INFO
|
||||
|
||||
logging.info("\n*** check API hook: info/all (2)")
|
||||
self.configure({"sharing": {"permit_properties_overlay": "False"}})
|
||||
|
||||
Reference in New Issue
Block a user