4646LIMITS_PROPERTY = "limits"
4747ENV_PROPERTY = "env"
4848ARGS_PROPERTY = "args"
49+ DATA_PROPERTY = "data"
4950
5051
5152class CommandConfigurationException (Exception ):
@@ -60,6 +61,11 @@ def check_call_config(call):
6061 raise CommandConfigurationException ("call value not a dictionary: {}" .
6162 format (call ))
6263
64+ for key in call .keys ():
65+ if key not in [URI_PROPERTY , METHOD_PROPERTY , API_TIMEOUT_PROPERTY , ASYNC_API_TIMEOUT_PROPERTY ,
66+ DATA_PROPERTY , HEADERS_PROPERTY ]:
67+ raise CommandConfigurationException (f"unknown property { key } in call { call } " )
68+
6369 uri = call .get (URI_PROPERTY )
6470 if not uri :
6571 raise CommandConfigurationException (f"no '{ URI_PROPERTY } ' key present in { call } " )
@@ -90,6 +96,40 @@ def check_call_config(call):
9096 raise CommandConfigurationException (f"{ ASYNC_API_TIMEOUT_PROPERTY } not an integer" , exc )
9197
9298
99+ def check_command_config (command ):
100+ """
101+ :param command: dictionary with executable command configuration
102+ """
103+ if not isinstance (command , dict ):
104+ raise CommandConfigurationException (f"command value not a dictionary: { command } " )
105+
106+ for key in command .keys ():
107+ if key not in [ENV_PROPERTY , ARGS_PROPERTY , LIMITS_PROPERTY , ARGS_SUBST_PROPERTY ]:
108+ raise CommandConfigurationException (f"unknown property { key } in command { command } " )
109+
110+ limits = command .get (LIMITS_PROPERTY )
111+ if limits :
112+ if not isinstance (command , dict ):
113+ raise CommandConfigurationException (f"limits value is not a dictionary in { command } " )
114+
115+ args = command .get (ARGS_PROPERTY )
116+ if not args :
117+ raise CommandConfigurationException (f"empty/missing args property in { command } " )
118+
119+ if not isinstance (args , list ):
120+ raise CommandConfigurationException (f"args property is not a list in { command } " )
121+
122+ args_subst = command .get (ARGS_SUBST_PROPERTY )
123+ if args_subst :
124+ if not isinstance (args_subst , dict ):
125+ raise CommandConfigurationException (f"args_subst value is not a dictionary in { command } " )
126+
127+ env = command .get (ENV_PROPERTY )
128+ if env :
129+ if not isinstance (env , dict ):
130+ raise CommandConfigurationException (f"env value is not a dictionary in { command } " )
131+
132+
93133def check_command_property (command ):
94134 """
95135 Check if the 'commands' parameter of CommandSequenceBase() has the right structure
@@ -111,6 +151,9 @@ def check_command_property(command):
111151 if call_value :
112152 check_call_config (call_value )
113153
154+ if command_value :
155+ check_command_config (command_value )
156+
114157
115158class ApiCall :
116159 """
@@ -129,7 +172,7 @@ def __init__(self, call_dict):
129172 if not self .method :
130173 self .method = "GET"
131174
132- self .data = call_dict .get ("data" )
175+ self .data = call_dict .get (DATA_PROPERTY )
133176
134177 self .headers = call_dict .get (HEADERS_PROPERTY )
135178 if not self .headers :
0 commit comments