From 5e87b88e9d8b34caed0a82464dbbfa5d64930096 Mon Sep 17 00:00:00 2001
From: Bin Sun <bins@vmware.com>
Date: Thu, 29 Mar 2018 15:40:18 +0800
Subject: CSIT for new feature in multicloud

Change-Id: I3f3808b7be5395cc40465c3d3977fc59b547c766
Issue-ID: MULTICLOUD-155
Signed-off-by: Bin Sun <bins@vmware.com>
---
 .../provision/jsoninput/image_file.json            |  7 +++++
 .../provision/sanity_test_image.robot              | 34 +++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 test/csit/tests/multicloud-vmware/provision/jsoninput/image_file.json

(limited to 'test/csit')

diff --git a/test/csit/tests/multicloud-vmware/provision/jsoninput/image_file.json b/test/csit/tests/multicloud-vmware/provision/jsoninput/image_file.json
new file mode 100644
index 000000000..1e3cac6f5
--- /dev/null
+++ b/test/csit/tests/multicloud-vmware/provision/jsoninput/image_file.json
@@ -0,0 +1,7 @@
+{
+        "name": "cirros-0.3.2-x86_64-disk",
+        "container_format": "bare",
+        "disk_format": "qcow2",
+        "visibility": "public",
+        "schema": "/v2/schemas/image"
+}
\ No newline at end of file
diff --git a/test/csit/tests/multicloud-vmware/provision/sanity_test_image.robot b/test/csit/tests/multicloud-vmware/provision/sanity_test_image.robot
index 0a6f2f5e8..e8e36dc14 100644
--- a/test/csit/tests/multicloud-vmware/provision/sanity_test_image.robot
+++ b/test/csit/tests/multicloud-vmware/provision/sanity_test_image.robot
@@ -13,10 +13,13 @@ Library     HttpLibrary.HTTP
 ${get_token_url}         /api/multicloud-vio/v0/vmware_fake/identity/v3/auth/tokens
 ${get_image_url}         /api/multicloud-vio/v0/vmware_fake/glance/v2/images
 ${get_image_schema_url}  /api/multicloud-vio/v0/vmware_fake/glance/v2/schemas/image
+${image_service}         /api/multicloud-vio/v0/vmware_fake/glance/v2/image/file
+
 
 
 #json files
 ${auth_info_json}        ${SCRIPTS}/../tests/multicloud-vmware/provision/jsoninput/auth_info.json
+${image_file}            ${SCRIPTS}/../tests/multicloud-vmware/provision/jsoninput/image_file.json
 
 #global vars
 ${TOKEN}
@@ -42,7 +45,7 @@ GetAuthToken
 
 
 
-TestCaseShoeImageSchema
+TestCaseShowImageSchema
     [Documentation]    Sanity test - Show Image Schema
     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json  X-Auth-Token=${TOKEN}
     Create Session    web_session    http://${VIO_IP}:9004    headers=${headers}
@@ -76,3 +79,32 @@ TestCaseShowImage
     List Should Contain Value    ${return_ok_list}   ${responese_code}
     ${response_json}    json.loads    ${resp.content}
     Should Be Equal     ${response_json['status']}    active
+
+
+
+
+TestCaseUploadImage
+    [Documentation]    Sanity test - Upload Image
+    ${json_value}=      json_from_file      ${image_file}
+    ${json_string}=     string_from_json   ${json_value}
+    ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json  X-Auth-Token=${TOKEN}
+    Create Session    web_session    http://${VIO_IP}:9004    headers=${headers}
+    ${resp}=  POST Request    web_session    ${image_service}   ${json_string}
+    ${responese_code}=     Convert To String      ${resp.status_code}
+    List Should Contain Value    ${return_ok_list}   ${responese_code}
+    ${response_json}    json.loads    ${resp.content}
+    ${IMAGEID}=    Convert To String  ${response_json['id']}
+    Set Global Variable   ${IMAGEID}
+
+
+
+
+TestCaseDownloadImage
+    [Documentation]    Sanity test - Download Image
+    ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json  X-Auth-Token=${TOKEN}
+    Create Session    web_session    http://${VIO_IP}:9004    headers=${headers}
+    ${resp}=  Get Request    web_session    ${image_service}/${IMAGEID}
+    ${responese_code}=     Convert To String      ${resp.status_code}
+    List Should Contain Value    ${return_ok_list}   ${responese_code}
+    ${response_json}    json.loads    ${resp.content}
+    Should Be Equal     ${response_json['status']}    active
\ No newline at end of file
-- 
cgit 1.2.3-korg