You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A list of unit tests for authz.RPCCapability and authz.RPCCapabilities data class.
Note:
confirm param_restrictions = field(type=dict, default=None). Should type be Dict[str, List[str]], consider cases like authz.RPCCapability("id.rpc1", {"k1": ["v1", "v1a"], "k2":{}})
[] negative:
Note: TODO: currently allow authz.RPCCapability("idrpc2"), but should we? If not, should we use regext to constrain the "key" as in . pattern?
init (empty init)
[] Note: this is a negative test (assert Exception)
Note: should we allow immutable-fashioned add_rpc_capability, i.e., authz.RPCCapabilities().add_rpc_capability(authz.RPCCapability("id.rpc1")) == authz.RPCCapabilities([authz.RPCCapability("id.rpc1")])
remove
Definition needed: do we allow remove parameter, value-of-parameter, or the whole resource.
no implementation for remove (e.g., remove_param_restrictions)
assert error for rpc_cap4.remove_param_restrictions("id2.rpc2")
remove by para rpc_cap4.remove_param_restrictions("p2")
remove by para-value rpc_cap4.remove_param_restrictions("v2")
implement immutable assignment
doc-string
list of tests for authz.RPCCapabilities
data class definition
Note: TODO: discussion: type of dict in _rpc_dict = field(type=dict, default=None, init=False) can be more rigid, i.e., Dict[str, Dict[str, List[str]]], e.g. _rpc_dict={'id.rpc1': {}, 'id2.rpc2': {'p2': 'v2'}}
Note: this is releated to the dict key merged and ordered logic
add
x = authz.RPCCapabilities(); x.add_rpc_capability(authz.RPCCapability("id.rpc1")); x == authz.RPCCapabilities([authz.RPCCapability("id.rpc1")])
Note: should we allow immutable-fashioned add_rpc_capability, i.e., authz.RPCCapabilities().add_rpc_capability(authz.RPCCapability("id.rpc1")) == authz.RPCCapabilities([authz.RPCCapability("id.rpc1")])
merge:
x = authz.RPCCapabilities(); x.add_rpc_capability(authz.RPCCapability("id.rpc1")); x.add_rpc_capability(authz.RPCCapability("id.rpc2")); x == authz.RPCCapabilities([authz.RPCCapability("id.rpc1"), authz.RPCCapability("id.rpc2")])
duplicate mechanism
x = authz.RPCCapabilities(); x.add_rpc_capability(authz.RPCCapability("id.rpc1")); x.add_rpc_capability(authz.RPCCapability("id.rpc1")); x == authz.RPCCapabilities([authz.RPCCapability("id.rpc1")])
Note: should we give warning when attempting to add duplicate authz.RPCCapability
remove
remove by capability "key" (i.e., <id.method>)
x = authz.RPCCapabilities([authz.RPCCapability("id.rpc1"), authz.RPCCapability("id2.rpc2"), authz.RPCCapability("id3.rpc3", {"p1": "v1"})]); x.remove_rpc_capability(authz.RPCCapability("id2.rpc2")); x = RPCCapabilities(rpc_capabilities=[RPCCapability(resource='id.rpc1', param_restrictions={}), RPCCapability(resource='id3.rpc3', param_restrictions={'p1': 'v1'})], _rpc_dict={'id.rpc1': {}, 'id3.rpc3': {'p1': 'v1'}})
Is your feature request related to a problem? Please describe.
A list of unit tests for authz.RPCCapability and authz.RPCCapabilities data class.
Note:
pin @craig8, @schandrika , @shwethanidd for discussion.
list of tests for authz.RPCCapability
data class definition
param_restrictions = field(type=dict, default=None)
. Should type be Dict[str, List[str]], consider cases likeauthz.RPCCapability("id.rpc1", {"k1": ["v1", "v1a"], "k2":{}})
[] negative:
init (empty init)
[] Note: this is a negative test (assert Exception)
init
display
(optional) display with pre-defined order
obj equal (seems to work)
add (partially broken)
see merge case below
merge: (partially broken)
duplicate mechanism
Note: should we allow immutable-fashioned add_rpc_capability, i.e., authz.RPCCapabilities().add_rpc_capability(authz.RPCCapability("id.rpc1")) == authz.RPCCapabilities([authz.RPCCapability("id.rpc1")])
remove
rpc_cap4.remove_param_restrictions("id2.rpc2")
doc-string
list of tests for authz.RPCCapabilities
dict
in_rpc_dict = field(type=dict, default=None, init=False)
can be more rigid, i.e., Dict[str, Dict[str, List[str]]], e.g. _rpc_dict={'id.rpc1': {}, 'id2.rpc2': {'p2': 'v2'}}The text was updated successfully, but these errors were encountered: