On Wed, Mar 26, 2014 at 2:25 PM, Hrvoje Ribicic <[email protected]> wrote:

> The original design of the RAPI symmetry test assumed that all RAPI
> calls that modify parameters use the PUT method. This is not true in
> the case of the node parameter modification method, and while that
> itself should be addressed or at least examined, the test method has
> to change to accomodate both PUT and POST requests.
>
> Signed-off-by: Hrvoje Ribicic <[email protected]>
> ---
>  qa/qa_rapi.py | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/qa/qa_rapi.py b/qa/qa_rapi.py
> index e49553d..b3b3d2f 100644
> --- a/qa/qa_rapi.py
> +++ b/qa/qa_rapi.py
> @@ -165,15 +165,17 @@ def _DoTests(uris):
>
>  # pylint: disable=W0212
>  # Due to _SendRequest usage
> -def _DoGetPutTests(get_uri, put_uri, opcode_params, exceptions=None,
> -                   set_exceptions=None):
> +def _DoGetPutTests(get_uri, modify_uri, opcode_params,
> modify_method="PUT",
> +                   exceptions=None, set_exceptions=None):
>    """ Test if all params of an object can be retrieved, and set as well.
>
>    @type get_uri: string
>    @param get_uri: The URI from which information about the object can be
>                    retrieved.
> -  @type put_uri: string
> -  @param put_uri: The URI which can be used to modify the object.
> +  @type modify_uri: string
> +  @param modify_uri: The URI which can be used to modify the object.
> +  @type modify_method: string
> +  @param modify_method: The method to be used in the modification.
>

Would you mind putting modify_method below opcode_params to match the
parameter order in the method?


>    @type opcode_params: list of tuple
>    @param opcode_params: The parameters of the underlying opcode, used to
>                          determine which parameters are actually present.
> @@ -187,7 +189,7 @@ def _DoGetPutTests(get_uri, put_uri, opcode_params,
> exceptions=None,
>    """
>
>    assert get_uri.startswith("/")
> -  assert put_uri.startswith("/")
> +  assert modify_uri.startswith("/")
>
>    # While these could be default values, any accidental assignment to them
>    # would permanently change the default for all invokers - safety first.
> @@ -196,7 +198,7 @@ def _DoGetPutTests(get_uri, put_uri, opcode_params,
> exceptions=None,
>    if set_exceptions is None:
>      set_exceptions = []
>
> -  print "Testing get/put symmetry of %s and %s" % (get_uri, put_uri)
> +  print "Testing get/modify symmetry of %s and %s" % (get_uri, modify_uri)
>
>    # First we see if all parameters of the opcode are returned through RAPI
>    params_of_interest = map(lambda x: x[0], opcode_params)
> @@ -218,9 +220,9 @@ def _DoGetPutTests(get_uri, put_uri, opcode_params,
> exceptions=None,
>      if param not in exceptions and param not in set_exceptions:
>        put_payload[param] = info[param]
>
> -  _rapi_client._SendRequest("PUT", put_uri, None, put_payload)
> +  _rapi_client._SendRequest(modify_method, modify_uri, None, put_payload)
>
> -  print "PUT successful at %s" % put_uri
> +  print "%s successful at %s" % (modify_method, modify_uri)
>  # pylint: enable=W0212
>
>
> --
> 1.9.1.423.g4596e3a
>
>
Rest LGTM, thanks.


-- 
Thomas Thrainer | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to