updating api tests to require real email for user policy

Change-Id: If70b22a6883b95e7bc11ce98de032f91e976cd23
diff --git a/src/test/cord-api/Framework/utils/utils.py b/src/test/cord-api/Framework/utils/utils.py
index 40d1dd6..e6bc46e 100644
--- a/src/test/cord-api/Framework/utils/utils.py
+++ b/src/test/cord-api/Framework/utils/utils.py
@@ -286,10 +286,10 @@
                 return random.choice([True, False])
         if value == 'int32' or value == 'uint32':
                 return random.randint(1,10000)
-	if value == 'float':
-		return random.uniform(1,10)
+        if value == 'float':
+            return random.uniform(1,10)
         else:
-                return None
+            return None
 
     def generate_random_slice_name(self):
         random_name = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(10))
diff --git a/src/test/cord-api/Tests/targets/xosapitests.xtarget b/src/test/cord-api/Tests/targets/xosapitests.xtarget
index 7342cf0..e827f77 100644
--- a/src/test/cord-api/Tests/targets/xosapitests.xtarget
+++ b/src/test/cord-api/Tests/targets/xosapitests.xtarget
@@ -24,10 +24,10 @@
 Create {{ m.name }}    CREATE    /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}}    ${json_{{ m.name | lower}}_1}
     [Tags]    {{ m.name }}
 
-Update {{ m.name }}    UPDATE    /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}}    ${json_{{ m.name | lower}}_updated_1}    ${id}
+Update {{ m.name }}    UPDATE    /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}}    ${json_{{ m.name | lower}}_amend_1}    ${id}
     [Tags]    {{ m.name }}
 
-Get {{ m.name }}    RETRIEVE    /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}}    ${json_{{ m.name | lower}}_updated_1}    ${id}    ${json_{{ m.name | lower}}_updated_key}
+Get {{ m.name }}    RETRIEVE    /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}}    ${json_{{ m.name | lower}}_amend_1}    ${id}    ${json_{{ m.name | lower}}_amend_key}
     [Tags]    {{ m.name }}
 
 Delete {{ m.name }}    DELETE    /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}}    data_id=${id}
@@ -49,9 +49,9 @@
     ${resp}=    Get Request    ${SERVER_IP}    ${service}/${id}
     Log    ${resp.content}
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${updated_value}=    Run Keyword If    '${key}' != 'null'    Get Json Value    ${resp.content}    /${key}
-    ${updated_value}=    Run Keyword If    '${key}' != 'null'    Remove String    ${updated_value}    "
-    Run Keyword If    '${key}' != 'null'    Should Contain    "${value}"    ${updated_value}
+    ${amend_value}=    Run Keyword If    '${key}' != 'null'    Get Json Value    ${resp.content}    /${key}
+    ${amend_value}=    Run Keyword If    '${key}' != 'null'    Remove String    ${amend_value}    "
+    Run Keyword If    '${key}' != 'null'    Should Contain    "${value}"    ${amend_value}
     [Return]    ${resp}
 
 CORD Post
@@ -90,13 +90,12 @@
     {% autoescape false %}
     {% endautoescape %}
     ${json_{{ m.name | lower }}_1}=    Set Variable    { }
-    ${json_{{ m.name | lower }}_updated_1}=    Set Variable    { }
-    ${json_{{ m.name | lower}}_updated_key}=    Set Variable    null
-    Set Suite Variable    ${json_{{ m.name | lower}}_updated_key}
+    ${json_{{ m.name | lower }}_amend_1}=    Set Variable    { }
+    ${json_{{ m.name | lower}}_amend_key}=    Set Variable    null
+    Set Suite Variable    ${json_{{ m.name | lower}}_amend_key}
     # set required fields for {{ m.name | lower }} object
     {% for f in m.fields + xproto_base_fields(m, proto.message_table) -%}
-    {% if f.modifier == "required" -%}
-    {% if f.options.blank == "False" -%}
+    {% if f.modifier == "required" and f.options.blank != "True" -%}
     {% if not f.options.default -%}
     {% if f.link -%}
     ${tmp_{{ f.options.model | lower }}_id}=    Create {{ f.options.model }}
@@ -104,16 +103,26 @@
     {% else -%}
     ${json_{{ m.name | lower}}_{{ f.name }}_1}=    Generate Random Value    {{ f.type }}
     ${json_{{ m.name | lower }}_1}=    Set Json Value    ${json_{{ m.name | lower }}_1}    /{{ f.name }}    "${json_{{ m.name | lower }}_{{ f.name }}_1}"
+    {% if f.name == "created" or f.name == "amend" or f.name =="expires" or f.name =='granted' -%}
+    ${json_{{ m.name | lower}}_{{ f.name }}_1}=    Generate Random Value    float
+    ${json_{{ m.name | lower}}_1}=    Set Json Value    ${json_{{ m.name | lower }}_1}    /{{ f.name }}    "${json_{{ m.name | lower}}_{{ f.name }}_1}"
+    {% else -%}
     {% if loop.index0 == 0 -%}
-    ${json_{{ m.name | lower}}_updated_key}=    Set Variable    {{ f.name }}
-    ${json_{{ m.name | lower}}_{{ f.name }}_updated_1}=    Generate Random Value    {{ f.type }}
-    ${json_{{ m.name | lower }}_updated_1}=    Set Json Value    ${json_{{ m.name | lower }}_updated__1}    /{{ f.name }}    "${json_{{ m.name | lower }}_{{ f.name }}_updated_1}"
+    ${json_{{ m.name | lower}}_amend_key}=    Set Variable    {{ f.name }}
+    ${json_{{ m.name | lower}}_{{ f.name }}_amend_1}=    Generate Random Value    {{ f.type }}
+    ${json_{{ m.name | lower }}_amend_1}=    Set Json Value    ${json_{{ m.name | lower }}_amend_1}    /{{ f.name }}    "${json_{{ m.name | lower }}_{{ f.name }}_amend_1}"
     {% endif -%}
     {% endif -%}
     {% endif -%}
     {% endif -%}
     {% endif -%}
     {% endfor -%}
+    {% if  m.name  == "User" -%}
+    ${json_{{ m.name | lower}}_email}=    Set Variable    testuser@opencord.org
+    ${json_{{ m.name | lower}}_1}=    Set Json Value    ${json_{{ m.name | lower }}_1}    /email    "${json_{{ m.name | lower }}_email}"
+    ${json_{{ m.name | lower}}_email_amend_1}=    Set Variable    testuseramend@opencord.org
+    ${json_{{ m.name | lower}}_amend_1}=    Set Json Value    ${json_{{ m.name | lower }}_amend_1}    /email    "${json_{{ m.name | lower }}_email_amend_1}"
+    {% endif %}
     {% if  m.name  == "Site" -%}
     ${json_{{ m.name | lower}}_login_base_tmp}=    Set Variable    testloginbase
     ${json_{{ m.name | lower}}_1}=    Set Json Value    ${json_{{ m.name | lower }}_1}    /login_base    "${json_{{ m.name | lower }}_login_base_tmp}"
@@ -121,13 +130,13 @@
     {% if  m.name  == "Slice" -%}
     ${json_{{ m.name | lower}}_name}=    Generate Random Slice Name
     ${json_{{ m.name | lower}}_1}=    Set Json Value    ${json_{{ m.name | lower }}_1}    /name    "${json_{{ m.name | lower }}_name}"
-    ${json_{{ m.name | lower}}_name_updated_1}=    Generate Random Slice Name
-    ${json_{{ m.name | lower}}_updated_1}=    Set Json Value    ${json_{{ m.name | lower }}_updated_1}    /name    "${json_{{ m.name | lower}}_name_updated_1}"
+    ${json_{{ m.name | lower}}_name_amend_1}=    Generate Random Slice Name
+    ${json_{{ m.name | lower}}_amend_1}=    Set Json Value    ${json_{{ m.name | lower }}_amend_1}    /name    "${json_{{ m.name | lower}}_name_amend_1}"
     {% endif %}
     ${json_{{ m.name | lower }}_1}=     To JSON    ${json_{{ m.name | lower }}_1}
-    ${json_{{ m.name | lower }}_updated_1}=     To JSON    ${json_{{ m.name | lower }}_updated_1}
+    ${json_{{ m.name | lower }}_amend_1}=     To JSON    ${json_{{ m.name | lower }}_amend_1}
     Set Suite Variable    ${json_{{ m.name | lower }}_1}
-    Set Suite Variable    ${json_{{ m.name | lower }}_updated_1}
+    Set Suite Variable    ${json_{{ m.name | lower }}_amend_1}
     {% endif -%}
     {% endfor %}
 
@@ -139,23 +148,30 @@
     # set required fields for {{ m.name | lower }} object
     {% for f in m.fields + xproto_base_fields(m, proto.message_table) -%}
     {% if f.link -%}
-    {% if f.modifier == "required" -%}
-    {% if f.options.blank == "False" -%}
+    {% if f.modifier == "required" and f.options.blank != "True"-%}
     # create dependent {{ f.options.model }}
     ${dependent_{{ f.options.model | lower }}_id}=    Create {{ f.options.model }}
     ${json_{{ m.name | lower}}_tmp}=    Set Json Value    ${json_{{ m.name | lower }}_tmp}    /{{ f.name }}_id    ${dependent_{{ f.options.model | lower }}_id}
     {% endif -%}
-    {% endif -%}
     {% else -%}
-    {% if f.modifier == "required" -%}
-    {% if f.options.blank == "False" -%}
+    {% if f.modifier == "required" and f.options.blank != "True"-%}
     {% if not f.options.default -%}
+    {% if m.name == "User" and f.name == "email" -%}
+    ${json_user_email_tmp}=   Generate Random Value    {{ f.type }}
+    ${json_user_email_tmp}=    Catenate    SEPARATOR=    ${json_user_email_tmp}    @opencord.org
+    ${json_user_tmp}=   Set Json Value    ${json_user_tmp}   /email    "${json_user_email_tmp}"
+    {% else -%}
+    {% if f.name == "created" or f.name == "amend" or f.name =="expires" or f.name =='granted' -%}
+    ${json_{{ m.name | lower}}_{{ f.name }}_tmp}=    Generate Random Value    float
+    ${json_{{ m.name | lower}}_tmp}=    Set Json Value    ${json_{{ m.name | lower }}_tmp}    /{{ f.name }}    "${json_{{ m.name | lower}}_{{ f.name }}_tmp}"
+    {% else -%}
     ${json_{{ m.name | lower}}_{{ f.name }}_tmp}=    Generate Random Value    {{ f.type }}
     ${json_{{ m.name | lower}}_tmp}=    Set Json Value    ${json_{{ m.name | lower }}_tmp}    /{{ f.name }}    "${json_{{ m.name | lower}}_{{ f.name }}_tmp}"
     {% endif -%}
     {% endif -%}
     {% endif -%}
     {% endif -%}
+    {% endif -%}
     {% endfor -%}
     {% if  m.name  == "Site" -%}
     ${json_{{ m.name | lower}}_login_base_tmp}=    Set Variable    testloginbase
@@ -200,3 +216,4 @@
     {% endif %}
     {% endfor -%}
     Delete All Sessions
+