Correcting Get Value from JSON
[integration/test.git] / csit / libraries / TemplatedRequests.robot
index 052080703a9f0e3fce314dac8be706ef6fa5b6d8..eece6288df2fe802a64f30230ea666ecafba003e 100644 (file)
@@ -1,13 +1,13 @@
 *** Settings ***
 Documentation     Resource for supporting http Requests based on data stored in files.
-...
+...           
 ...               Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
-...
+...           
 ...               This program and the accompanying materials are made available under the
 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
-...
-...
+...           
+...           
 ...               The main strength of this library are *_As_*_Templated keywords
 ...               User gives a path to directory where files with templates for URI
 ...               and XML (or JSON) data are present, and a mapping with substitution to make;
@@ -16,12 +16,12 @@ Documentation     Resource for supporting http Requests based on data stored in
 ...               Simple example (tidy insists on single space where 4 spaces should be):
 ...               TemplatedRequests.Put_As_Json_Templated folder=${VAR_BASE}/person mapping={"NAME":"joe"}
 ...               TemplatedRequests.Get_As_Json_Templated folder=${VAR_BASE}/person mapping={"NAME":"joe"} verify=True
-...
+...           
 ...               In that example, we are PUTting "person" data with specified value for "NAME" placeholder.
 ...               We are not verifying PUT response (probably empty string which is not a valid JSON),
 ...               but we are issuing GET (same URI) and verifying the repsonse matches the same data.
 ...               Both lines are returning text response, but in the example we are not saving it into variable.
-...
+...           
 ...               Optionally, *_As_*_Templated keywords call verification of response.
 ...               There are separate Verify_* keywords, for users who use intermediate processing.
 ...               For JSON responses, there is a support for normalizing.
@@ -29,12 +29,12 @@ Documentation     Resource for supporting http Requests based on data stored in
 ...               *_Uri keywords do not use templates, but may be useful in general,
 ...               perhaps for users who call Resolve_Text_* keywords.
 ...               *_As_*_Uri are the less flexible but less argument-heavy versions of *_Uri keywords.
-...
+...           
 ...               This resource supports generating data with simple lists.
 ...               ${iterations} argument control number of items, "$i" will be substituted
 ...               automatically (not by the provided mapping) with integers starting with ${iter_start} (default 1).
 ...               For example "iterations=2 iter_start=3" will create items with i=3 and i=4.
-...
+...           
 ...               This implementation relies on file names to distinguish data.
 ...               Each file is expected to end in newline, compiled data has final newline removed.
 ...               Here is a table so that users can create their own templates:
@@ -48,7 +48,7 @@ Documentation     Resource for supporting http Requests based on data stored in
 ...               *.prolog.*: Temlate with data before iterated items.
 ...               *.item.*: Template with data piece corresponding to one item.
 ...               *.epilog.*: Temlate with data after iterated items.
-...
+...           
 ...               One typical use of this Resource is to make runtime changes to ODL configuration.
 ...               Different ODL parts have varying ways of configuration,
 ...               this library affects only the Config Subsystem way.
@@ -56,7 +56,7 @@ Documentation     Resource for supporting http Requests based on data stored in
 ...               a NETCONF server as its publicly available entry point.
 ...               Netconf-connector feature makes this netconf server available for RESTCONF calls.
 ...               Be careful to use appropriate feature, odl-netconf-connector* does not work in cluster.
-...
+...           
 ...               This Resource currently calls RequestsLibrary directly,
 ...               so it does not work with AuthStandalone or similar.
 ...               This Resource does not maintain any internal Sessions.
@@ -70,16 +70,16 @@ Documentation     Resource for supporting http Requests based on data stored in
 ...               both on session level (where it becomes a default value for requests) and on request
 ...               level (when present, it overrides the session value). To override the default
 ...               value keywords' http_timeout parameter may be used.
-...
+...           
 ...               These Keywords contain frequent BuiltIn.Log invocations,
 ...               so they are not suited for scale or performance suites.
 ...               And as usual, performance tests should use specialized utilities,
 ...               as Robot in general and this Resource specifically will be too slow.
-...
+...           
 ...               As this Resource makes assumptions about intended headers,
 ...               it is not flexible enough for suites specifically testing Restconf corner cases.
 ...               Also, list of allowed http status codes is quite rigid and broad.
-...
+...           
 ...               Rules for ordering Keywords within this Resource:
 ...               1. User friendlier Keywords first.
 ...               2. Get, Put, Post, Delete, Verify.
@@ -94,18 +94,18 @@ Documentation     Resource for supporting http Requests based on data stored in
 ...               Json is less prone to element ordering issues.
 ...               PUT does not fail on existing element, also it does not allow
 ...               shortened URIs (container instead keyed list element) as Post does.
-...
+...           
 ...               TODO: Add ability to override allowed status codes,
 ...               so that negative tests do not need to parse the failure message.
-...
+...           
 ...               TODO: Migrate suites to this Resource and remove *ViaRestconf Resources.
-...
+...           
 ...               TODO: Currently the verification step is only in *_As_*_Templated keywords.
 ...               It could be moved to "non-as" *_Templated ones,
 ...               but that would take even more horizontal space. Is it worth doing?
-...
+...           
 ...               TODO: Should iterations=0 be supported for JSON (remove [])?
-...
+...           
 ...               TODO: Currently, ${ACCEPT_EMPTY} is used for JSON-expecting requests.
 ...               perhaps explicit ${ACCEPT_JSON} will be better, even if it sends few bytes more?
 Library           Collections
@@ -120,7 +120,7 @@ Resource          ${CURDIR}/../variables/Variables.robot
 @{ALLOWED_DELETE_STATUS_CODES}    ${200}    ${201}    ${204}    ${404}    # List of integers, not strings. Used by DELETE if the resource may be not present.
 @{ALLOWED_STATUS_CODES}    ${200}    ${201}    ${204}    # List of integers, not strings. Used by both PUT and DELETE (if the resource should have been present).
 @{DATA_VALIDATION_ERROR}    ${400}    # For testing mildly negative scenarios where ODL reports user error.
-@{DELETED_STATUS_CODE}    ${404}    # List of integers, not strings. Used by DELETE if the resource may be not present.
+@{DELETED_STATUS_CODES}    ${404}    ${409}    # List of integers, not strings. Used by DELETE if the resource may be not present.
 # TODO: Add option for delete to require 404.
 @{INTERNAL_SERVER_ERROR}    ${500}    # Only for testing severely negative scenarios where ODL cannot recover.
 @{KEYS_WITH_BITS}    op    # the default list with keys to be sorted when norm_json libray is used