Removed deprecated tests. Added tests for sessions.

Change-Id: I9a448daf438a48d5e469abbad1d70b5576c6efdc
This commit is contained in:
Timur Nurlygayanov
2013-07-31 17:40:20 -04:00
parent e39b3b2bd6
commit 6960c8ce7b
10 changed files with 136 additions and 1946 deletions

View File

@@ -1,8 +1,7 @@
*** Settings ***
Suite Setup
Library simple_REST.py
Resource new_rest_keywords.txt
Resource rest.txt
Resource keywords.txt
*** Test Cases ***
Create environment
@@ -19,94 +18,22 @@ Get list of environments
Update Environment
[Setup] Set Default Headers
${id} Get Environment ID test
${id} Get Environment ID by name test
User send a PUT request to '/environments/${id}' with body {"name": "new_name"}
The response code should be 200
The response body should have key 'name' with value "new_name"
Get environment parameters
[Setup] Set Default Headers
${id} Get Environment ID new_name
${id} Get Environment ID by name new_name
User send a GET request to '/environments/${id}'
The response body should have keys status created updated version
The response body should have keys id name services
Get environment parameter name
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a GET request to '/environments/${id}/name'
The response code should be 200
The response body should be "new_name"
Get environment parameter id
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a GET request to '/environments/${id}/id'
The response code should be 200
The response body should be "${id}"
Get environment parameter services
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a GET request to '/environments/${id}/id'
The response code should be 200
The response body should be []
Set environment parameter name
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a PUT request to '/environments/${id}/name' with body "new2"
The response code should be 200
The response body should be "new2"
Set environment parameter id
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a PUT request to '/environments/${id}/id' with body "new2"
The response code should be 200
The response body should be "new2"
Set environment parameter version
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a PUT request to '/environments/${id}/version' with body "2.0"
The response code should be 200
The response body should be "2.0"
Set environment parameter services
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a PUT request to '/environments/${id}/services' with body {"name": "service1"}
The response code should be 200
The response body should be {"name": "service1"}
Add new parameter for environment
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a PUT request to '/environments/${id}/bugs' with body [1,2,3,4,5]
The response code should be 200
The response body should be [1,2,3,4,5]
Delete required parameter for environment
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a DELETE request to '/environments/${id}/id'
The response code should be 200
Delete optional parameter for environment
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a DELETE request to '/environments/${id}/version'
The response code should be 200
Delete extra parameter for environment
[Setup] Set Default Headers
${id} Get Environment ID new_name
User send a DELETE request to '/environments/${id}/bugs'
The response code should be 200
Delete Environment
[Setup] Set Default Headers
${id} Get Environment ID new_name
${id} Get Environment ID by name new_name
User send a DELETE request to '/environments/${id}'
The response code should be 200
User send a GET request to '/environments/${id}'
The response code should be 404

View File

@@ -1,20 +0,0 @@
*** Settings ***
Library simple_REST.py
Library Collections
Resource rest.txt
*** Test Cases ***
Begin of testing
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
Get Headers
Delete all environments
[Tags] thread1
Delete All Environments
Get empty list of environments
[Tags] thread1
${result} Get List Of Environments
${len} Get Length ${result['environments']}
Should Be Equal As Integers ${len} 0

View File

@@ -1,657 +0,0 @@
*** Settings ***
Library simple_REST.py
Library Collections
Resource rest.txt # =============== All enviroments must be delete before these tests
*** Test Cases ***
List environments w/o token
[Tags] thread1
Set Headers {"Content-Type":"application/json"}
${result} Get List Of Environments 401
Should Be Empty ${result}
Create environment w/o token
[Tags] thread1
Set Headers {"Content-Type":"application/json"}
Create Environment ${template}_thread1_1 401
Get X-Auth-Token ${ip_keystone}
${env_id} Get Environment ID ${template}_thread1_1
Should Be Equal ${env_id} None
Update environment w/o token
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_2 200
Set body {"name":"${template}_thread1_2_1"}
${env_id} Get Environment ID ${template}_thread1_2
Set Headers {"Content-Type":"application/json"}
PUT request http://${ip}:8082/environments/${env_id}
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
${env_id} Get Environment ID ${template}_thread1_2_1
Should Be Equal ${env_id} None
${env_id} Get Environment ID ${template}_thread1_2
Should Not Be Equal ${env_id} None
Delete Environment ${template}_thread1_2 200
Delete environment w/o token
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_3 200
${env_id} Get Environment ID ${template}_thread1_3
Set Headers {"Content-Type":"application/json"}
DELETE request http://${ip}:8082/environments/${env_id}
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
${env_id} Get Environment ID ${template}_thread1_3
Should Not Be Equal ${env_id} None
Delete Environment ${template}_thread1_3 200
Create a session w/o token
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_4 200
${env_id} Get Environment ID ${template}_thread1_4
Set Headers {"Content-Type":"application/json"}
POST request wo body http://${ip}:8082/environments/${env_id}/configure
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
Delete Environment ${template}_thread1_4 200
Get session information w/o token
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_5 200
${resp} Create Session ${template}_thread1_5 200
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}_thread1_5
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
Delete Environment ${template}_thread1_5 200
Get session report w/o token
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_6 200
${resp} Create Session ${template}_thread1_6 200
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}_thread1_6
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/sessions/${session_id}/reports
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
Delete Environment ${template}_thread1_6 200
Delete session w/o token
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_7 200
${resp} Create Session ${template}_thread1_7 200
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}_thread1_7
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
Delete request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
Delete Environment ${template}_thread1_7 200
Deploy session of not empty environment w/o token
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_8
Check Environment ${template}_thread1_8 ready
${resp} Create Session ${template}_thread1_8
${session_id} Set Variable ${resp['id']}
${resp} Get session information ${template}_thread1_8 ${session_id}
Should Be Equal ${resp['state']} open
Create service ${template}_thread1_8 AD AD_1
${env_id} Get Environment ID ${template}_thread1_8
Check Environment ${template}_thread1_8 pending
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
POST request wo body http://${ip}:8082/environments/${env_id}/sessions/${session_id}/deploy
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
Check Environment ${template}_thread1_8 pending
${resp} Get session information ${template}_thread1_8 ${session_id}
Should Be Equal ${resp['state']} open
${result} Get deployments ${template}_thread1_8
Should Be Empty ${result['deployments']}
Delete Environment ${template}_thread1_8 200
Create AD w/o token
[Tags] thread1
${env_name} Set Variable _thread1_9
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}${env_name}
${auth} Set Variable {"type": "activeDirectory", "name": "AD_0", "adminPassword": "swordfish", "domain": "acme.dc", "units": [{"isMaster": true, "recoveryPassword": "swordfish", "location": "west-dc"}, {"isMaster": false, "recoveryPassword": "swordfish", "location": "west-dc"}]}
Set Body ${auth}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
POST request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
${resp} Get List of AD ${template}${env_name}
Should Be Empty ${resp}
Delete Environment ${template}${env_name} 200
Get List of ADs w/o token
[Tags] thread1
${env_name} Set Variable _thread1_10
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} AD AD_1
${env_id} Get Environment ID ${template}${env_name}
GET request http://${ip}:8082/environments/${env_id}/services
${resp} Get Response body
Should Contain AD_1 ${resp[0]['name']}
Get Headers
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
GET request http://${ip}:8082/environments/${env_id}/services
${resp} Get Response body
Should Contain AD_1 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Delete AD w/o token
[Tags] thread1
${env_name} Set Variable _thread1_11
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} AD AD_2
${resp} Get List of AD ${template}${env_name}
Should Be Equal AD_2 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
DELETE request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of AD ${template}${env_name}
Should Be Equal AD_2 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Create IIS w/o token
[Tags] thread1
${env_name} Set Variable _thread1_12
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}${env_name}
${auth} Set Variable {"type": "webServer", "name": "IIS_0", "adminPassword": "swordfish", "domain": "acme.dc", "units": [{}]}
Set Body ${auth}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
POST request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
${resp} Get List of IIS ${template}${env_name}
Should Be Empty ${resp}
Delete Environment ${template}${env_name} 200
Get List of IISs w/o token
[Tags] thread1
${env_name} Set Variable _thread1_13
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} IIS IIS_1
${resp} Get List of All Services ${template}${env_name}
Should Be Equal IIS_1 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of IIS ${template}${env_name}
Should Be Equal IIS_1 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Delete IIS w/o token
[Tags] thread1
${env_name} Set Variable _thread1_14
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} IIS IIS_2
${resp} Get List of IIS ${template}${env_name}
Should Be Equal IIS_2 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Get Headers
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
DELETE request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of IIS ${template}${env_name}
Should Be Equal IIS_2 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Create ASP.Net w/o token
[Tags] thread1
${env_name} Set Variable _thread1_15
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}${env_name}
${auth} Set Variable {"type": "aspNetApp", "name": "ASP_0", "credentials": {"username": "Administrator","password": "swordfish"}, "domain": "acme.dc", "adminPassword": "swordfish", "units":[{}], "repository": "git://github.com/Mirantis/murano-mvc-demo.git"}
Set Body ${auth}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
POST request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
${resp} Get List of ASP ${template}${env_name}
Should Be Empty ${resp}
Delete Environment ${template}${env_name} 200
Get List of ASP.Nets w/o token
[Tags] thread1
${env_name} Set Variable _thread1_16
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} ASP ASP_1
${resp} Get List of ASP ${template}${env_name}
Should Be Equal ASP_1 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of ASP ${template}${env_name}
Should Be Equal ASP_1 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Delete ASP.Net w/o token
[Tags] thread1
${env_name} Set Variable _thread1_17
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} ASP ASP_2
${resp} Get List of ASP ${template}${env_name}
Should Be Equal ASP_2 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
DELETE request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of ASP ${template}${env_name}
Should Be Equal ASP_2 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Create IIS Farm w/o token
[Tags] thread1
${env_name} Set Variable _thread1_18
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}${env_name}
${auth} Set Variable {"type": "webServerFarm", "name": "IIS_Farm_0", "adminPassword": "swordfish", "domain": "acme.dc", "units": [{}], "loadBalancerPort": "80"}
Set Body ${auth}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
POST request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
${resp} Get List of IIS Farm ${template}${env_name}
Should Be Empty ${resp}
Delete Environment ${template}${env_name} 200
Get List of IIS Farms w/o token
[Tags] thread1
${env_name} Set Variable _thread1_19
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} IIS Farm IIS_Farm_1
${resp} Get List of IIS Farm ${template}${env_name}
Should Be Equal IIS_Farm_1 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of IIS Farm ${template}${env_name}
Should Be Equal IIS_Farm_1 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Delete IIS Farm w/o token
[Tags] thread1
${env_name} Set Variable _thread1_20
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} IIS Farm IIS_Farm_2
${resp} Get List of IIS Farm ${template}${env_name}
Should Be Equal IIS_Farm_2 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Get Headers
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
DELETE request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of IIS Farm ${template}${env_name}
Should Be Equal IIS_Farm_2 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Create ASP.Net Farm w/o token
[Tags] thread1
${env_name} Set Variable _thread1_21
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}${env_name}
${auth} Set Variable {"type": "aspNetAppFarm", "name": "ASP_Farm_0", "credentials": {"username": "Administrator","password": "swordfish"}, "domain": "acme.dc", "adminPassword": "swordfish", "units":[{}], "repository": "git://github.com/Mirantis/murano-mvc-demo.git", "loadBalancerPort": "80"}
Set Body ${auth}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
POST request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
${resp} Get List of ASP Farm ${template}${env_name}
Should Be Empty ${resp}
Delete Environment ${template}${env_name} 200
Get List of ASP.Net Farms w/o token
[Tags] thread1
${env_name} Set Variable _thread1_22
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} ASP Farm ASP_Farm_1
${resp} Get List of ASP Farm ${template}${env_name}
Should Be Equal ASP_Farm_1 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of ASP Farm ${template}${env_name}
Should Be Equal ASP_Farm_1 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Delete ASP.Net Farm w/o token
[Tags] thread1
${env_name} Set Variable _thread1_23
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}${env_name}
${resp} Create Session ${template}${env_name}
${session_id} Set Variable ${resp['id']}
Create service ${template}${env_name} ASP Farm ASP_Farm_2
${resp} Get List of ASP Farm ${template}${env_name}
Should Be Equal ASP_Farm_2 ${resp[0]['name']}
${env_id} Get Environment ID ${template}${env_name}
Get Headers
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
DELETE request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
${resp} Get List of ASP Farm ${template}${env_name}
Should Be Equal ASP_Farm_2 ${resp[0]['name']}
Delete Environment ${template}${env_name} 200
Update environment w/o env_id and with incorrect env_id ========================
[Tags] thread1
${env_name} Set Variable _thread1_24
Get X-Auth-Token ${ip_keystone}
Create Environment ${template}${env_name} 200
Set body {"name":"${template}${env_name}_1"}
PUT request http://${ip}:8082/environments
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
Set body {"name":"${template}${env_name}_1"}
PUT request http://${ip}:8082/environments/aboie785r6awi84asevi7ryzcth7it5
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
Set body {"name":"${template}${env_name}_1"}
PUT request http://${ip}:8082/environments/${template}${env_name}
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
${env_id} Get Environment ID ${template}${env_name}_1
Should Be Equal ${env_id} None
${env_id} Get Environment ID ${template}${env_name}
Should Not Be Equal ${env_id} None
Delete Environment ${template}${env_name} 200
Delete environment w/o env_id and with incorrect env_id
[Tags] thread1
${env_name} Set Variable _thread1_25
Get X-Auth-Token ${ip_keystone}
Create Environment ${template}${env_name} 200
DELETE request http://${ip}:8082/environments/
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
DELETE request http://${ip}:8082/environments/98tw89esh85yjzop7thi8ax38otyzdp
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
DELETE request http://${ip}:8082/environments/${template}${env_name}
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
${env_id} Get Environment ID ${template}${env_name}
Should Not Be Equal ${env_id} None
Delete Environment ${template}${env_name} 200
Create a session w/o env_id and with incorrect env_id
${env_name} Set Variable _thread1_26
Get X-Auth-Token ${ip_keystone}
Create Environment ${template}${env_name} 200
${env_id} Get Environment ID ${template}${env_name}
POST request wo body http://${ip}:8082/environments/configure
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
POST request wo body http://${ip}:8082/environments/djkfghasekjyrtwev8ytno8aeyaeip/configure
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
POST request wo body http://${ip}:8082/environments/${template}${env_name}/configure
${resp_code} Get Response Code
Should Be Equal As Integers 404 ${resp_code}
Delete Environment ${template}${env_name} 200
Get session information w/o env_id
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_5 200
${resp} Create Session ${template}_thread1_5 200
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}_thread1_5
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
Delete Environment ${template}_thread1_5 200
Get session report w/o env_id
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_6 200
${resp} Create Session ${template}_thread1_6 200
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}_thread1_6
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
GET request http://${ip}:8082/environments/${env_id}/sessions/${session_id}/reports
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
${resp} Get Response body
Should Be Empty ${resp}
Update Headers X-Auth-Token ${token}
Delete Environment ${template}_thread1_6 200
Delete session w/o env_id
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_7 200
${resp} Create Session ${template}_thread1_7 200
${session_id} Set Variable ${resp['id']}
${env_id} Get Environment ID ${template}_thread1_7
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
Delete request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
Delete Environment ${template}_thread1_7 200
Deploy session of not empty environment w/o env_id
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
${resp} Get Headers
${token} Set Variable ${resp['X-Auth-Token']}
Create Environment ${template}_thread1_8
Check Environment ${template}_thread1_8 ready
${resp} Create Session ${template}_thread1_8
${session_id} Set Variable ${resp['id']}
${resp} Get session information ${template}_thread1_8 ${session_id}
Should Be Equal ${resp['state']} open
Create service ${template}_thread1_8 AD AD_1
${env_id} Get Environment ID ${template}_thread1_8
Check Environment ${template}_thread1_8 pending
Set Headers {"Content-Type":"application/json"}
Update Headers X-Configuration-Session ${session_id}
POST request wo body http://${ip}:8082/environments/${env_id}/sessions/${session_id}/deploy
${resp_code} Get Response Code
Should Be Equal As Integers 401 ${resp_code}
Update Headers X-Auth-Token ${token}
Check Environment ${template}_thread1_8 pending
${resp} Get session information ${template}_thread1_8 ${session_id}
Should Be Equal ${resp['state']} open
${result} Get deployments ${template}_thread1_8
Should Be Empty ${result['deployments']}
Delete Environment ${template}_thread1_8 200

View File

@@ -1,521 +0,0 @@
*** Settings ***
Library simple_REST.py
Library Collections
Resource rest.txt
*** Test Cases ***
Begin of testing
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
Get Headers
Create environment ================
[Tags] thread1
Create Environment ${template}_rest-api_env
${env_id} Get Environment ID ${template}_rest-api_env
Should Not Be Equal ${env_id} None
Edit environment
[Tags] thread1
${result} Get List Of Environments
${list} Format List ${result['environments']}
Log List ${list}
Update Environment ${template}_rest-api_env ${template}_env_2_modify
${result} Get List Of Environments
${list} Format List ${result['environments']}
Log List ${list}
${env_id} Get Environment ID ${template}_env_2_modify
Should Not Be Equal ${env_id} None
Delete environment
Delete Environment ${template}_env_2_modify
${env_id} Get Environment ID ${template}_env_2_modify
Should Be Equal ${env_id} None
${result} Get List Of Environments
${list} Format List ${result['environments']}
Log List ${list}
Create session to environment ===========
[Tags] thread1
Create Environment ${template}_rest-api_env1
${result} Create session ${template}_rest-api_env1
Should Not Be Empty ${result['id']}
Set Global Variable ${session_id} ${result['id']}
Log ${session_id}
Get session information_1
[Tags] thread1
${result} Get session information ${template}_rest-api_env1 ${session_id}
Log ${result}
Delete session
[Tags] thread1
Delete session ${template}_rest-api_env1 ${session_id}
${result} Get session information ${template}_rest-api_env1 ${session_id} 404
Delete session ${template}_rest-api_env1 ${session_id} 404
# !!!!!!!!!!!!!!!!!!!!!! Response code must be 404, not 500!!!!!!
Delete Environment ${template}_rest-api_env1
Create AD service ===============
[Tags] thread1
Create Environment ${template}_rest-api_ad
Create session ${template}_rest-api_ad
Create service ${template}_rest-api_ad AD ad001
List AD services
[Tags] thread1
${result} Get List of AD ${template}_rest-api_ad
Log List ${result}
${len} Get Length ${result}
Should Be Equal as Integers 1 ${len}
Delete AD service
[Tags] thread1
Delete service ${template}_rest-api_ad ad001
${result} Get List of AD ${template}_rest-api_ad
${len} Get Length ${result}
Should Be Equal as Integers ${len} 0
Delete Environment ${template}_rest-api_ad
Create IIS service =============
[Tags] thread1
Create Environment ${template}_rest-api_iis
Create session ${template}_rest-api_iis
Create service ${template}_rest-api_iis IIS iis001
List IIS services
[Tags] thread1
${result} Get List of IIS ${template}_rest-api_iis
${len} Get Length ${result}
Should Be Equal as Integers 1 ${len}
Delete IIS service
[Tags] thread1
Delete service ${template}_rest-api_iis iis001
${result} Get List of IIS ${template}_rest-api_iis
${len} Get Length ${result}
Should Be Equal as Integers ${len} 0
Delete Environment ${template}_rest-api_iis
Create ASP NET service ===============
[Tags] thread1
Create Environment ${template}_rest-api_asp
Create session ${template}_rest-api_asp
Create service ${template}_rest-api_asp ASP asp001
List ASP NET services
[Tags] thread1
${result} Get List of ASP ${template}_rest-api_asp
${len} Get Length ${result}
Should Be Equal as Integers 1 ${len}
Delete ASP NET service
[Tags] thread1
Delete service ${template}_rest-api_asp asp001
${result} Get List of ASP ${template}_rest-api_asp
${len} Get Length ${result}
Should Be Equal as Integers ${len} 0
Delete Environment ${template}_rest-api_asp
Create ASP NET Farm service =====================
[Tags] thread1
Create Environment ${template}_rest-api_aspfarm
Create session ${template}_rest-api_aspfarm
Create service ${template}_rest-api_aspfarm ASP Farm aspFarm001
List ASP NET Farm services
[Tags] thread1
${result} Get List of ASP Farm ${template}_rest-api_aspfarm
${len} Get Length ${result}
Should Be Equal as Integers 1 ${len}
Delete ASP NET Farm service
[Tags] thread1
Delete service ${template}_rest-api_aspfarm aspFarm001
${result} Get List of ASP Farm ${template}_rest-api_aspfarm
${len} Get Length ${result}
Should Be Equal as Integers ${len} 0
Delete Environment ${template}_rest-api_aspfarm
Create IIS Farm service ================
[Tags] thread1
Create Environment ${template}_rest-api_iisfarm
Create session ${template}_rest-api_iisfarm
Create service ${template}_rest-api_iisfarm IIS Farm iisFarm001
List IIS Farm services
[Tags] thread1
${result} Get List of IIS Farm ${template}_rest-api_iisfarm
${len} Get Length ${result}
Should Be Equal as Integers 1 ${len}
Delete IIS Farm service
[Tags] thread1
Delete service ${template}_rest-api_iisfarm iisFarm001
${result} Get List of IIS Farm ${template}_rest-api_iisfarm
${len} Get Length ${result}
Should Be Equal as Integers ${len} 0
Delete Environment ${template}_rest-api_iisfarm
Create some services ================
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
Create Environment ${template}_rest-api_thread2
Create session ${template}_rest-api_thread2
Create service ${template}_rest-api_thread2 AD ad001
Create service ${template}_rest-api_thread2 AD ad002
Create service ${template}_rest-api_thread2 AD ad005
Create service ${template}_rest-api_thread2 ASP asp005
Create service ${template}_rest-api_thread2 ASP asp005
Create service ${template}_rest-api_thread2 IIS Farm iisFarm002
Create service ${template}_rest-api_thread2 ASP asp006
Create service ${template}_rest-api_thread2 ASP Farm aspFarm005
Create service ${template}_rest-api_thread2 ASP Farm aspfarm005
Create service ${template}_rest-api_thread2 IIS iis003
Create service ${template}_rest-api_thread2 IIS Farm iisFarm003
Create service ${template}_rest-api_thread2 IIS iis001
Create service ${template}_rest-api_thread2 IIS iis_001
Create service ${template}_rest-api_thread2 IIS iis001
Create service ${template}_rest-api_thread2 IIS iis002
Create service ${template}_rest-api_thread2 AD ad001
Create service ${template}_rest-api_thread2 IIS Farm iisFarm002
Create service ${template}_rest-api_thread2 IIS Farm iisFarm004
Create service ${template}_rest-api_thread2 IIS Farm iisFarm005
Create service ${template}_rest-api_thread2 IIS Farm iisFarm006
# View all services
${list} Get List of All Services ${template}_rest-api_thread2
${len} Get Length ${list}
Should Be Equal as Integers 20 ${len}
${list} Format List ${list}
Log List ${list}
# Check number of ADs
${result} Get List of AD ${template}_rest-api_thread2
Log List ${result}
${len} Get Length ${result}
Should Be Equal as Integers 4 ${len}
# Check number of IISs
${result} Get List of IIS ${template}_rest-api_thread2
Log List ${result}
${len} Get Length ${result}
Should Be Equal as Integers 5 ${len}
# Check number of ASP NETs
${result} Get List of ASP ${template}_rest-api_thread2
Log List ${result}
${len} Get Length ${result}
Should Be Equal as Integers 3 ${len}
# Check number of IIS Farms
${result} Get List of IIS Farm ${template}_rest-api_thread2
Log List ${result}
${len} Get Length ${result}
Should Be Equal as Integers 6 ${len}
# Check number of ASP NET Farms
${result} Get List of ASP Farm ${template}_rest-api_thread2
Log List ${result}
${len} Get Length ${result}
Should Be Equal as Integers 2 ${len}
Delete all of some services
[Tags] thread1
Delete service ${template}_rest-api_thread2 iisFarm003
Delete service ${template}_rest-api_thread2 aspFarm005
Delete service ${template}_rest-api_thread2 iis001
Delete service ${template}_rest-api_thread2 iisFarm002
Delete service ${template}_rest-api_thread2 iisFarm004
Delete service ${template}_rest-api_thread2 iis001
Delete service ${template}_rest-api_thread2 ad005
Delete service ${template}_rest-api_thread2 aspfarm005
Delete service ${template}_rest-api_thread2 iis003
Delete service ${template}_rest-api_thread2 iis_001
Delete service ${template}_rest-api_thread2 asp005
Delete service ${template}_rest-api_thread2 ad002
Delete service ${template}_rest-api_thread2 asp006
Delete service ${template}_rest-api_thread2 iis002
Delete service ${template}_rest-api_thread2 ad001
Delete service ${template}_rest-api_thread2 iisFarm005
Delete service ${template}_rest-api_thread2 asp005
Delete service ${template}_rest-api_thread2 iisFarm002
Delete service ${template}_rest-api_thread2 ad001
Delete service ${template}_rest-api_thread2 iisFarm006
# View all services
${list} Get List of All Services ${template}_rest-api_thread2
${len} Get Length ${list}
Should Be Equal as Integers 0 ${len}
Log List ${list}
Delete Environment ${template}_rest-api_thread2
Test of multisession =====================
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
Create Environment ${template}_rest-api_thread3
${result} Create session ${template}_rest-api_thread3
Should Not Be Empty ${result['id']}
Set Global Variable ${session_id} ${result['id']}
# Store session
${session1_1} Set Variable ${session_id}
# Create additional sessions
${result} Create session ${template}_rest-api_thread3
${session1_2} Set Variable ${result['id']}
${result} Create session ${template}_rest-api_thread3
${session1_3} Set Variable ${result['id']}
# Stage 1: Begin of create some services ===================
Update Headers X-Configuration-Session ${session1_1}
Create service ${template}_rest-api_thread3 AD ad001
Create service ${template}_rest-api_thread3 AD ad002
Create service ${template}_rest-api_thread3 ASP asp005
Create service ${template}_rest-api_thread3 ASP asp005
Create service ${template}_rest-api_thread3 IIS Farm iisFarm002
Create service ${template}_rest-api_thread3 ASP asp006
Create service ${template}_rest-api_thread3 ASP Farm aspFarm005
Create service ${template}_rest-api_thread3 ASP Farm aspfarm005
Create service ${template}_rest-api_thread3 IIS iis003
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
Update Headers X-Configuration-Session ${session1_2}
Create service ${template}_rest-api_thread3 AD ad001
Create service ${template}_rest-api_thread3 ASP asp005
Create service ${template}_rest-api_thread3 ASP asp005
Create service ${template}_rest-api_thread3 IIS Farm iisFarm002
Create service ${template}_rest-api_thread3 ASP asp006
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
Update Headers X-Configuration-Session ${session1_3}
Create service ${template}_rest-api_thread3 ASP asp005_3
Create service ${template}_rest-api_thread3 ASP asp005_3
Create service ${template}_rest-api_thread3 IIS Farm iisFarm002_3
Create service ${template}_rest-api_thread3 ASP asp006_3
Create service ${template}_rest-api_thread3 ASP Farm aspFarm005_3
Create service ${template}_rest-api_thread3 ASP Farm aspfarm005_3
Create service ${template}_rest-api_thread3 IIS iis003_3
Create service ${template}_rest-api_thread3 IIS Farm iisFarm003_3
Create service ${template}_rest-api_thread3 IIS iis001_3
Create service ${template}_rest-api_thread3 IIS iis_001_3
Create service ${template}_rest-api_thread3 IIS iis001_3
Create service ${template}_rest-api_thread3 IIS iis002_3
Create service ${template}_rest-api_thread3 IIS Farm iisFarm002_3
Create service ${template}_rest-api_thread3 IIS Farm iisFarm004_3
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
# Stage 2: End of create some services ===================
Update Headers X-Configuration-Session ${session1_1}
Create service ${template}_rest-api_thread3 IIS Farm iisFarm003
Create service ${template}_rest-api_thread3 IIS iis001
Create service ${template}_rest-api_thread3 IIS iis002
Create service ${template}_rest-api_thread3 AD ad001
Create service ${template}_rest-api_thread3 IIS Farm iisFarm002
Create service ${template}_rest-api_thread3 IIS Farm iisFarm004
Create service ${template}_rest-api_thread3 IIS Farm iisFarm005
Create service ${template}_rest-api_thread3 IIS Farm iisFarm006
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
Update Headers X-Configuration-Session ${session1_2}
Create service ${template}_rest-api_thread3 ASP Farm aspFarm005
Create service ${template}_rest-api_thread3 ASP Farm aspfarm005
Create service ${template}_rest-api_thread3 IIS iis003
Create service ${template}_rest-api_thread3 IIS Farm iisFarm003
Create service ${template}_rest-api_thread3 IIS iis001
Create service ${template}_rest-api_thread3 IIS iis_001
Create service ${template}_rest-api_thread3 IIS iis002
Create service ${template}_rest-api_thread3 AD ad001
Create service ${template}_rest-api_thread3 IIS Farm iisFarm002
Create service ${template}_rest-api_thread3 IIS Farm iisFarm005
Create service ${template}_rest-api_thread3 IIS Farm iisFarm006
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
Update Headers X-Configuration-Session ${session1_3}
Create service ${template}_rest-api_thread3 AD ad001_3
Create service ${template}_rest-api_thread3 IIS Farm iisFarm005_3
Create service ${template}_rest-api_thread3 IIS Farm iisFarm006_3
# === View services in all sessions ===
Update Headers X-Configuration-Session ${session1_1}
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
${len} Get Length ${list}
Should Be Equal as Integers 17 ${len}
Update Headers X-Configuration-Session ${session1_2}
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
${len} Get Length ${list}
Should Be Equal as Integers 16 ${len}
Update Headers X-Configuration-Session ${session1_3}
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
${len} Get Length ${list}
Should Be Equal as Integers 17 ${len}
# Need control of number created services
# Stage 3: delete some services ===================
Delete service ${template}_rest-api_thread3 iis_001_3
Delete service ${template}_rest-api_thread3 iis002_3
Delete service ${template}_rest-api_thread3 iisFarm006_3
Delete service ${template}_rest-api_thread3 aspfarm005_3
Delete service ${template}_rest-api_thread3 ad001_3
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
${len} Get Length ${list}
Should Be Equal as Integers 12 ${len}
Update Headers X-Configuration-Session ${session1_2}
Delete service ${template}_rest-api_thread3 iis_001
Delete service ${template}_rest-api_thread3 iis002
Delete service ${template}_rest-api_thread3 ad001
Delete service ${template}_rest-api_thread3 iisFarm006
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
${len} Get Length ${list}
Should Be Equal as Integers 12 ${len}
Update Headers X-Configuration-Session ${session1_1}
Delete service ${template}_rest-api_thread3 ad001
Delete service ${template}_rest-api_thread3 ad002
Delete service ${template}_rest-api_thread3 asp005
Delete service ${template}_rest-api_thread3 asp005
Delete service ${template}_rest-api_thread3 iisFarm002
Delete service ${template}_rest-api_thread3 asp006
Delete service ${template}_rest-api_thread3 aspFarm005
Delete service ${template}_rest-api_thread3 aspfarm005
Delete service ${template}_rest-api_thread3 iis003
Delete service ${template}_rest-api_thread3 iisFarm003
Delete service ${template}_rest-api_thread3 iis001
Delete service ${template}_rest-api_thread3 iis002
Delete service ${template}_rest-api_thread3 ad001
Delete service ${template}_rest-api_thread3 iisFarm002
Delete service ${template}_rest-api_thread3 iisFarm004
Delete service ${template}_rest-api_thread3 iisFarm005
Delete service ${template}_rest-api_thread3 iisFarm006
# View all services
${list} Get List of All Services ${template}_rest-api_thread3
Log List ${list}
${len} Get Length ${list}
Should Be Equal as Integers 0 ${len}
Delete Environment ${template}_rest-api_thread3
Deploy one AD
[Tags] thread5
Create environment ${template}_ad_depl
${result} Create session ${template}_ad_depl
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_ad_depl AD deploy.com
Deploy session ${template}_ad_depl ${session_id}
Wait Until Keyword Succeeds 30m 10s Check Environment ${template}_ad_depl ready
Get Environment ID ${template}_ad_depl
#Delete environment ${template}_ad_depl
Deploy one IIS
[Tags] thread5
Create environment ${template}_bigden-iis
${result} Create session ${template}_bigden-iis
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_bigden-iis IIS IIS_2_deploy
Deploy session ${template}_bigden-iis ${session_id}
Wait Until Keyword Succeeds 20m 5s Check Environment ${template}_bigden-iis ready
Get Environment ID ${template}_bigden-iis
Delete environment ${template}_bigden-iis
Deploy one ASP.NET
[Tags] thread5
Create environment ${template}_bigden-asp
${result} Create session ${template}_bigden-asp
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_bigden-asp ASP ASP_2_deploy
Deploy session ${template}_bigden-asp ${session_id}
Wait Until Keyword Succeeds 20m 5s Check Environment ${template}_bigden-asp ready
Get Environment ID ${template}_bigden-asp
Delete environment ${template}_bigden-asp
Deploy one ASP.NET Farm
[Tags] thread5
Create environment ${template}_bigden-asp-farm
${result} Create session ${template}_bigden-asp-farm
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_bigden-asp-farm ASP Farm ASP-Farm_2_deploy
Deploy session ${template}_bigden-asp-farm ${session_id}
Wait Until Keyword Succeeds 20m 5s Check Environment ${template}_bigden-asp-farm ready
Get Environment ID ${template}_bigden-asp-farm
Delete environment ${template}_bigden-asp-farm
Deploy one IIS Farm
[Tags] thread5
Create environment ${template}_bigden-iis-farm
${result} Create session ${template}_bigden-iis-farm
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_bigden-iis-farm IIS Farm IIS-Farm_2_deploy
Deploy session ${template}_bigden-iis-farm ${session_id}
Wait Until Keyword Succeeds 40m 5s Check Environment ${template}_bigden-iis-farm ready
Get Environment ID ${template}_bigden-iis-farm
Delete environment ${template}_bigden-iis-farm
Sequence deploy
[Tags] thread5
Create environment ${template}_bigden-all_service
${result} Create session ${template}_bigden-all_service
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_bigden-all_service AD AD_2_deploy
Create service ${template}_bigden-all_service IIS IIS_2_deploy
Create service ${template}_bigden-all_service ASP ASP.NET_2_deploy
#Create service ${template}_bigden-all_service ASP Farm ASP.NET_Farm_2_deploy
#Create service ${template}_bigden-all_service IIS Farm IIS_Farm_2_deploy
Deploy session ${template}_bigden-all_service ${session_id}
Wait Until Keyword Succeeds 60m 10s Check Environment ${template}_bigden-all_service ready
Get Environment ID ${template}_bigden-all_service
Delete environment ${template}_bigden-all_service
Double deploy
[Tags] thread5
Create environment ${template}_double_dep
${result} Create session ${template}_double_dep
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_double_dep AD deploy.com
Deploy session ${template}_double_dep ${session_id}
Wait Until Keyword Succeeds 20m 10s Check Environment ${template}_double_dep ready
${result} Get deployments ${template}_double_dep
${result} Get deployment info ${template}_double_dep ${result['deployments'][0]['id']}
Format deploy report ${result}
${result} Create session ${template}_double_dep
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_double_dep IIS IIS_2_deploy
Deploy session ${template}_double_dep ${session_id}
Wait Until Keyword Succeeds 20m 10s Check Environment ${template}_double_dep ready
${result} Get deployments ${template}_double_dep
${result} Get deployment info ${template}_double_dep ${result['deployments'][0]['id']}
Format deploy report ${result}
Get Environment ID ${template}_double_dep
#Delete environment ${template}_double_dep
Delete deployment in time of deploy
[Tags] thread5
Create environment ${template}_deploy_ad0
${result} Create session ${template}_deploy_ad0
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_deploy_ad0 AD AD_2_deploy.com
Get deployments ${template}_deploy_ad0
Deploy session ${template}_deploy_ad0 ${session_id}
${result} Get deployments ${template}_deploy_ad0
Get deployment info ${template}_deploy_ad0 ${result['deployments'][0]['id']}
Sleep 1m
${result} Get deployments ${template}_deploy_ad0
Get deployment info ${template}_deploy_ad0 ${result['deployments'][0]['id']}
Sleep 1m
${result} Get deployments ${template}_deploy_ad0
${result} Get deployment info ${template}_deploy_ad0 ${result['deployments'][0]['id']}
Format deploy report ${result}
#Delete environment ${template}_deploy_ad0
Delete session after deploy
[Tags] thread5
Create environment ${template}_deploy_ad
${result} Create session ${template}_deploy_ad
Set Global Variable ${session_id} ${result['id']}
Create service ${template}_deploy_ad AD AD_2_deploy
Deploy session ${template}_deploy_ad ${session_id}
Wait Until Keyword Succeeds 60m 20s Check Environment ${template}_deploy_ad ready
Delete session ${template}_deploy_ad ${session_id} 200
Delete session ${template}_deploy_ad ${session_id} 404
Delete environment ${template}_deploy_ad
Delete session ${template}_deploy_ad ${session_id} 404

View File

@@ -0,0 +1,100 @@
*** Settings ***
Suite Setup
Library simple_REST.py
Resource keywords.txt
*** Test Cases ***
Create session for environment
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test001"}
The response code should be 200
${id} Get Environment ID by name test001
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
The response body should have key 'environment_id' with value "${id}"
Get session parameters
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test002"}
The response code should be 200
${id} Get Environment ID by name test002
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session} Get Response Body
User send a GET request to '/environments/${id}/sessions/${session['id']}'
The response code should be 200
The response body should have keys id environment_id created updated
The response body should have keys user_id version state
The response body should have key 'state' with value "open"
Create a few sessions for one environment
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test003"}
The response code should be 200
${id} Get Environment ID by name test003
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session1} Get Response Body
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session2} Get Response Body
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session3} Get Response Body
User send a GET request to '/environments/${id}/sessions/${session1['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session2['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session3['id']}'
The response code should be 200
Deploy empty session
[Tags] bug MRN-706
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test004-test"}
The response code should be 200
${id} Get Environment ID by name test004-test
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session} Get Response Body
User send a POST request to '/environments/${id}/sessions/${session['id']}/deploy' without body
The response code should be 200
Sleep 5
User send a GET request to '/environments/${id}/sessions/${session['id']}'
The response body should have key 'state' with value "open"
Delete session
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test005"}
The response code should be 200
${id} Get Environment ID by name test005
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session} Get Response Body
User send a DELETE request to '/environments/${id}/sessions/${session['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session['id']}'
The response code should be 404
Delete only one session
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test006"}
The response code should be 200
${id} Get Environment ID by name test006
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session1} Get Response Body
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session2} Get Response Body
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session3} Get Response Body
User send a DELETE request to '/environments/${id}/sessions/${session2['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session2['id']}'
The response code should be 404
User send a GET request to '/environments/${id}/sessions/${session1['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session3['id']}'
The response code should be 200

View File

@@ -1,42 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from ConfigParser import ConfigParser
from os import getcwd
from os.path import join
_settingsFileName = join(getcwd(), 'resources', 'settings.ini')
class Settings(object):
""" 'settings.ini' driver. """
def __init__(self):
"""
Loads default variables from the 'resources/settings.ini' file.
Arguments:
- None.
Return:
- None.
"""
try:
conf = ConfigParser()
conf.read(_settingsFileName)
for setting in conf.options('default'):
setattr(self, setting, conf.get('default', setting))
except:
pass

View File

@@ -1,250 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from ConfigParser import ConfigParser
from os import getcwd
from os.path import join
from bs4 import BeautifulSoup
class ArtificialIntelligence:
"""
This class allows to find input and select controls
without manual input of identificators.
We can find input fields by labels near those fields
"""
def __init__(self, page_source):
"""
Class constructor.
Arguments:
- page_source: web page source code.
Return:
- None.
"""
self.page_source = page_source
def _get_xpath_of_element(self, element):
"""
This function allows to get xpath of soup elements.
Arguments:
- element: selector name.
Return:
- element xpath.
"""
number = 1
try:
number += len(element.find_previous_siblings(element.name))
except:
pass
xpath = element.name + '[' + str(number) + ']'
for parent in element.findParents():
if parent.name != '[document]':
k = 0
for tag in parent.find_previous_siblings():
if tag.name == parent.name:
k += 1
if k == 0:
xpath = parent.name + '/' + xpath
else:
xpath = parent.name + '[' + str(k + 1) + ']/' + xpath
print xpath
return xpath
def extra_search(self, soup, label_element, element_type, value):
"""
This function allows to get element by its parameters.
Arguments:
- soup: soup structure;
- label_element: element with specified name;
- element_type: element tag name;
- value: element name.
Return:
- label_element.
"""
elements_types = element_type.split('/')
for t in elements_types:
if not label_element:
label_element = soup.find(t, text=str(value))
if not label_element:
label_element = soup.find(t, attrs={'value': value})
if not label_element:
label_element = soup.find(t, attrs={'title': value})
if not label_element:
try:
element = soup.find(text=str(value))
label_element = element.parent.\
find_next(text=str(element_type))
except:
pass
if not label_element:
try:
element = soup.find(text=str(value))
print element
label_element = element.parent.\
find_previous(text=str(element_type)).parent
print label_element
except:
pass
print label_element
return label_element
def find_element(self, label, element_type='input', method='next'):
"""
Looks for specified element on the page.
Arguments:
- label: selector name;
- element_type: element tag name. It could be any tag or several
tags (then they are listed as 'select/input/a');
- method: element search method. If 'next' is set, then function
is looking for the next input field after the specified element.
Otherwise it returns the specified element itself.
Return:
- element xpath.
Examples:
| ${xpath} | Find element | E-mail | input | next |
| ${xpath} | Find element | Cancel | a/div | this |
"""
html = str(self.page_source.encode("utf-8", "replace"))
" load html to soup structure for parsing "
soup = BeautifulSoup(html)
" search element after the label"
try:
if method == 'next':
label_element = soup.find(text=str(label))
label_element = self.extra_search(soup, label_element,
element_type, label)
element = label_element.parent.find_next(element_type)
elif method == 'previous':
label_element = soup.find(text=str(label))
label_element = self.extra_search(soup, label_element,
element_type, label)
element = label_element.parent.find_previous(element_type)
else:
label_element = soup.find(element_type, text=str(label))
element = self.extra_search(soup, label_element,
element_type, label)
" return xpath of element "
return self._get_xpath_of_element(element)
except:
return ""
_objRepoFileName = join(getcwd(), 'resources', 'ObjRepo.ini')
class Utils(object):
""" Boffin heart. """
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
__version__ = '0.1'
def get_element_from_repo(self, element_name):
"""
Returns element type, identificator and frame from
the 'resources/ObjRepo.ini' file by element name.
Arguments:
- elementName: selector name.
Return:
- <list> [elType, elIdentificator, elFrame].
Example:
| ${element} | Get Element From Repo | Banner Page 2 Button |
Will return
[xpath, //div[@class='bx-pager']/a[contains(@class, 'pager-2')]]
"""
try:
name = element_name.lower().replace(' ', '')
conf = ConfigParser()
conf.read(_objRepoFileName)
element_type = conf.get(name, 'type')
element_identificator = conf.get(name, 'identificator')
element_frame = conf.get(name, 'frame')
return [element_type, element_identificator, element_frame]
except:
return ['', None, '']
def get_element_frame(self, elementName):
"""
Returns element frame by its name in the 'resources/ObjRepo.ini' file.
Arguments:
- elementName: selector name.
Return:
- elFrame.
Example:
| ${elFrame} | GetElementFrame | Post Text field |
Will return 'posteditorframe'.
"""
result = self.get_element_from_repo(elementName)
if len(result) > 1:
return result[2]
def get_element_selector(self, name, page_source=None,
element_type='input', method='next'):
"""
Returns element selector by its name in the
'resources/ObjRepo.ini' file.
Arguments:
- name: selector name;
- page_source: web page source code;
- element_type: element tag name. It could be any tag or several
tags (then they are listed as 'select/input/a');
- method: element search method. If 'next' is set, then function
is looking for the next input field after the specified element.
Otherwise it returns the specified element itself.
Return:
- elIdentificator.
Examples:
| ${selector} | Get element selector | User Name | ${source_code} \
| input | next |
| ${selector} | Get element selector | Submit Button | ${source_code} \
| a | this |
"""
_type, _id, _frame = self.get_element_from_repo(name)
if not _id and page_source:
_frame = ''
boffin = ArtificialIntelligence(page_source)
_id = boffin.find_element(name, element_type, method)
if _id:
_type = 'xpath'
prefix = '' if _type == '' else str(_type) + '='
return prefix + str(_id)

View File

@@ -1,11 +1,12 @@
*** Settings ***
Library simple_REST.py
Resource rest.txt
Library Collections
*** Variables ***
${ip} 172.18.79.80
${ip_keystone} 172.18.124.201
${user} admin
${project} admin
${password} swordfish
${template} jenkinss
${url} http://?
@@ -20,6 +21,12 @@ User send a POST request to '${end_point}' with body ${body}
Set Body ${request_body}
POST Request ${url}
User send a POST request to '${end_point}' without body
Set Global Variable ${url} http://${ip}:8082${end_point}
Set Global Variable ${method} POST
Log "POST request on link ${url} without body"
POST Request Without Body ${url}
User send a PUT request to '${end_point}' with body ${body}
${request_body} Set Variable ${body}
Set Global Variable ${url} http://${ip}:8082${end_point}
@@ -40,6 +47,17 @@ User send a DELETE request to '${end_point}'
Log "DELETE request on link ${url}"
DELETE Request ${url}
Get Environment ID by name
[Arguments] ${name}
${id} Set Variable None
User send a GET request to '/environments'
The response code should be 200
${body} Get Response Body
@{environments} Convert To List ${body['environments']}
: FOR ${x} IN @{environments}
\ ${id} = Set Variable If "${x['name']}" == "${name}" ${x['id']}
[Return] ${id}
The response code should be ${status_code}
${response_body} Get Response Body
${response_code} Get Response Code
@@ -85,4 +103,10 @@ The response body parameter '${para}' should have key '${key}' with value "${val
Should Be Equal ${body['${para}']['${key}']} ${value}
Set Default Headers
Get X-Auth-Token ${ip_keystone}
Set Headers {"Content-Type": "application/json"}
${body} Set Variable {"auth": {"tenantName": "${project}", "passwordCredentials": {"username": "${user}", "password": "${password}"}}}
Set Body ${body}
POST Request http://${ip_keystone}:5000/v2.0/tokens
The response code should be 200
${body} Get Response Body
Update Headers X-Auth-Token ${body['access']['token']['id']}

View File

@@ -1,360 +0,0 @@
*** Settings ***
Library simple_REST.py
Library Collections
Resource new_rest_keywords.txt
*** Variables ***
${ip} 172.18.79.80
${ip_keystone} 172.18.124.201
${user} admin
${password} swordfish
${template} jenkins
*** Keywords ***
Get X-Auth-Token
[Arguments] ${ip} ${user}="admin" ${password}="swordfish" ${project}="admin"
[Documentation] This function allows to get X-Auth-Token for requests headers
...
... Examples:
... You can use this function with default values:
... | *Get X-Auth-Token* \ | 10.10.10.1 |
... | *POST Request* \ | 10.10.10.1:8082/environments |
...
... Or specify custom values for authentication:
... | *Get X-Auth-Token* \ | 10.10.10.1 | user | password |
... | *GET Request* \ \ \ \ \ \ \ | 10.10.10.1:8082/environments |
Set Headers {"Content-Type":"application/json"}
${auth} Set Variable {"auth": {"tenantName": ${project}, "passwordCredentials": {"username": ${user}, "password": ${password}}}}
Set Body ${auth}
POST Request http://${ip}:5000/v2.0/tokens
${body} Get Response Body
Update Headers X-Auth-Token ${body['access']['token']['id']}
Get List Of Environments
[Arguments] ${wait_resp}=200
[Documentation] This function returns list of all environments.
... Return response body with environments
...
... Examples:
... | \ ${result} \ | *Get List Of Environments* \ \ |
... | \ *LOG* \ | ${result['environments']} \ |
GET request http://${ip}:8082/environments
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${result} get response body
[Return] ${result}
Create Environment
[Arguments] ${environment_name} ${wait_resp}=200
[Documentation] This function sends POST request to create new environment
... Return response body
...
... Examples
... | *Create Environment* \ | \ env001 |
Set body {"name":"${environment_name}"}
POST request http://${ip}:8082/environments
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${result} get response body
[Return] ${result}
Get Environment ID
[Arguments] ${environment_name}
[Documentation] This function returns *ID* of environment
...
... Examples:
... | *Create Environment* \ | test |
... | ${id} \ | *Get Environment ID* | \ test |
... | *LOG* \ | ${id} |
${environment_id} Set Variable None
${data} Get List Of Environments
@{environments_list} Convert To List ${data['environments']}
: FOR ${x} IN @{environments_list}
\ ${environment_id} = Set Variable If "${x['name']}" == "${environment_name}" ${x['id']} ${environment_id}
[Return] ${environment_id}
Update Environment
[Arguments] ${environment_name} ${new_environment_name} ${wait_resp}=200
[Documentation] This function sends PUT request to update environment
... Return response body
...
... Examples
... | *Create Environment* \ | \ env001 |
... | *Update Environment* \ | \ env001 | \ env001_modify |
Set body {"name":"${new_environment_name}"}
${env_id} Get Environment ID ${environment_name}
PUT request http://${ip}:8082/environments/${env_id}
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${result} get response body
[Return] ${result}
Check Environment
[Arguments] ${environment_name} ${status}
[Documentation] This function check environment for given status
...
... Examples:
... | *Create Environment* \ | test00 |
... | *Check Environment* \ | test01 | ready |
${env_id} Get Environment ID ${environment_name}
${environment_status} Set Variable None
${data} Get List Of Environments
@{environments_list} Convert To List ${data['environments']}
: FOR ${x} IN @{environments_list}
\ ${environment_status} = Set Variable If "${x['name']}" == "${environment_name}" ${x['status']} ${environment_status}
Log ${environment_status}
Should Be Equal ${status} ${environment_status}
Delete Environment
[Arguments] ${environment_name} ${wait_resp}=200
[Documentation] This function sends DELETE request to delete one environment
...
... Examples:
... | *Create Environment* | test |
... | *Delete Environment* | test |
${env_id} Get Environment ID ${environment_name}
DELETE request http://${ip}:8082/environments/${env_id}
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
Delete All Environments
Set Default Headers
${result} Get List Of Environments
@{list} Convert To List ${result['environments']}
: FOR ${environment} IN @{list}
\ Delete Environment ${environment['name']}
Format List
[Arguments] ${list_2_format}
[Documentation] This function log list in nice view with name and id
...
... Examples:
... | *Create Environment* \ | test00 |
... | *Create Environment* \ | test01 |
... | ${id} \ | *Get List of Environments* |
... | *Format List* \ | ${id['environments']} |
${nice_list} = Create List
@{list} Convert To List ${list_2_format}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} ${x['name']}, id: ${x['id']}
Log List ${nice_list}
[Return] ${nice_list}
Create Session
[Arguments] ${environment_name} ${wait_resp}=200
[Documentation] This function sends POST request to create new session
... in environment_name
...
... Examples
... | *Create Environment* \ | \ env001 |
... | \${result} | *Create Session* \ | \ env001 |
${env_id} Get Environment ID ${environment_name}
POST request wo body http://${ip}:8082/environments/${env_id}/configure
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${resp} Get Response body
${session_id} Set Variable ${resp['id']}
Log ${session_id}
Update Headers X-Configuration-Session ${session_id}
[Return] ${resp}
Get session information
[Arguments] ${environment_name} ${session_id} ${wait_resp}=200
[Documentation] This function sends GET request to get session information
... with session_id in environment_name. Return response body.
...
... Examples
... | *Create Environment* \ | \ env001 |
... | \${result} | *Create Session* \ | \ env001 |
... | *Get Session Information* \ | \${result['id']} |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${resp} Get Response body
[Return] ${resp}
Format session report
[Arguments] ${session_report}
[Documentation] This function format report to user-frienly view
... Return list
...
... Examples
... | *Create Environment* \ | \ env001 |
... | \${result} | *Create Session* \ | \ env001 |
... | *Create AD* \ | \ env001 | \ ad001 |
... | *Deploy Session* \ | \${result['id']} |
... | \${report} | *Get Session Reports* \ | \${result['id']} |
... | \${rep} | *Format session report* \ | \${report} |
... | *Log* | \${rep} |
${nice_list} = Create List
@{list} Convert To List ${session_report['reports']}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} time: ${x['created']}, text: ${x['text']}
Log List ${nice_list}
[Return] ${nice_list}
Deploy session
[Arguments] ${environment_name} ${session_id} ${wait_resp}=200
[Documentation] This function sends POST request to deploy session
... with session_id in environment_name. No return
...
... Examples
... | *Create Environment* \ | \ env001 |
... | \${result} | *Create Session* \ | \ env001 |
... | *Deploy Session* \ | \${result['id']} |
${env_id} Get Environment ID ${environment_name}
POST request wo body http://${ip}:8082/environments/${env_id}/sessions/${session_id}/deploy
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
Delete session
[Arguments] ${environment_name} ${session_id} ${wait_resp}=200
[Documentation] This function sends DELETE request to delete session
... with session_id in environment_name
...
... Examples
... | *Create Environment* \ | \ env001 |
... | \${result} | *Create Session* \ | \ env001 |
... | *Delete Session* \ | \${result['id']} |
${env_id} Get Environment ID ${environment_name}
DELETE request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
Get deployments
[Arguments] ${environment_name} ${wait_resp}=200
[Documentation] This function sends GET request to get deployments of
... environment_name. Return response body
...
... Examples
... | *Create Environment* \ | \ env001 |
... | \${result} | *Create Session* \ | \ env001 |
... | *Deploy Session* \ | \${result['id']} |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/deployments
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${resp} Get Response body
[Return] ${resp}
Get deployment info
[Arguments] ${environment_name} ${deploy_id} ${wait_resp}=200
[Documentation] This function sends GET request to get deployments of
... environment_name. Return response body
...
... Examples
... | *Create Environment* \ | \ env001 |
... | \${result} | *Create Session* \ | \ env001 |
... | *Deploy Session* \ | \${result['id']} |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/deployments/${deploy_id}
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${resp} Get Response body
[Return] ${resp}
Format deploy report
[Arguments] ${deploy_report}
[Documentation] This function format report to user-frienly view
... Return list
...
... Examples
... | *Create Environment* \ | \ env001 |
... | \${result} | *Create Session* \ | \ env001 |
... | *Create AD* \ | \ env001 | \ ad001 |
... | *Deploy Session* \ | \${result['id']} |
... | \${report} | *Get Session Reports* \ | \${result['id']} |
... | \${rep} | *Format session report* \ | \${report} |
... | *Log* | \${rep} |
${nice_list} = Create List
@{list} Convert To List ${deploy_report['reports']}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} time: ${x['created']}, text: ${x['text']}
Log List ${nice_list}
[Return] ${nice_list}
Create service
[Arguments] ${environment_name} ${type} ${service_name} ${wait_resp}=200
[Documentation] This function sends POST request to create new service
... of given type with name service_name in environment_name.
... Header must be filled correctly.
... Return response body.
...
... Examples
... | *Create Environment* \ | \ env001 |
... | *Create Session* \ | \ env001 |
... | *Create service* \ | \ env001 | \ AD | \ qwerty.com |
... | *Create service* \ | \ env001 | \ IIS | \ qwe |
${env_id} Get Environment ID ${environment_name}
${body} Set Variable None
${body} = Set Variable If "${type}" == "AD" {"type": "activeDirectory","name": "${service_name}", "adminPassword": "P@ssw0rd", "domain": "${service_name}", "availabilityZone": "'Region1", "unitNamingPattern": "", "flavor": "m1.medium", "configuration": "standalone", "units": [{"isMaster": true, "recoveryPassword": "P@ssw0rd", "location": "west-dc"}, {"isMaster": false, "recoveryPassword": "P@ssw0rd"}]} ${body}
${body} = Set Variable If "${type}" == "IIS" {"type": "webServer", "name": "${service_name}", "adminPassword": "swordfish", "domain": "acme.dc", "units": [{}]} ${body}
${body} = Set Variable If "${type}" == "ASP" {"type": "aspNetApp", "name": "${service_name}", "credentials": {"username": "Administrator","password": "swordfish"}, "domain": "acme.dc", "adminPassword": "swordfish", "units":[{}], "repository": "git://github.com/Mirantis/murano-mvc-demo.git"} ${body}
${body} = Set Variable If "${type}" == "IIS Farm" {"type": "webServerFarm", "name": "${service_name}", "adminPassword": "swordfish", "domain": "acme.dc", "units": [{}], "loadBalancerPort": "80"} ${body}
${body} = Set Variable If "${type}" == "ASP Farm" {"type": "aspNetAppFarm", "name": "${service_name}", "credentials": {"username": "Administrator","password": "swordfish"}, "domain": "acme.dc", "adminPassword": "swordfish", "units":[{}], "repository": "git://github.com/Mirantis/murano-mvc-demo.git", "loadBalancerPort": "80"} ${body}
Set Body ${body}
POST request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${resp} Get Response body
[Return] ${resp}
Get List of
[Arguments] ${service_type} ${environment_name} ${wait_resp}=200
[Documentation] This function sends GET request to list services with
... given service_type in environment_name. Header must be filled correctly.
... Service_type may be "All Services", "AD", "IIS", "ASP", "IIS Farm" or "ASP Farm"
... Incorrect service_type equated to "All Service".
... Return response body.
...
... Examples
... | *Create Environment* \ | \ env001 |
... | *Create Session* \ | \ env001 |
... | *Create * \ | \ env001 | \ AD | \ ad001 |
... | *Get List of* \ | \ AD | \ env001 |
... | *Get List of* \ | \ IIS | \ env001 |
... | *Get List of* \ | \ ASP Farm | \ env001 |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${resp} Get Response body
${type} Set Variable "All Services"
${type} Set Variable If "${service_type}" == "AD" "activeDirectory" ${type}
${type} Set Variable If "${service_type}" == "IIS" "webServer" ${type}
${type} Set Variable If "${service_type}" == "ASP" "aspNetApp" ${type}
${type} Set Variable If "${service_type}" == "IIS Farm" "webServerFarm" ${type}
${type} Set Variable If "${service_type}" == "ASP Farm" "aspNetAppFarm" ${type}
${service_list} = Create List
@{list} Convert To List ${resp}
: FOR ${x} IN @{list}
\ Run Keyword If ${type} == "All Services" Append To List ${service_list} ${x}
\ Run Keyword If "${x['type']}" == ${type} Append To List ${service_list} ${x}
Log List ${service_list}
[Return] ${service_list}
Delete service
[Arguments] ${environment_name} ${service_name} ${wait_resp}=200
[Documentation] This function sends DELETE request to delete service_name
... in environment_name. Header must be filled correctly.
... Service_type is not specified.
...
... Examples
... | *Create Environment* \ | \ env001 |
... | *Create Session* \ | \ env001 |
... | *Create service* \ | \ env001 | \ AD | \ ad001 |
... | *Delete service* \ | \ env001 | \ ad001 |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/services
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}
${resp} Get Response body
${ser_id} Set Variable None
${service_list} = Create List
@{list} Convert To List ${resp}
: FOR ${x} IN @{list}
\ ${ser_id} = Set Variable If "${x['name']}" == "${service_name}" ${x['id']} ${ser_id}
DELETE request http://${ip}:8082/environments/${env_id}/services/${ser_id}
${resp_code} Get Response Code
Should Be Equal As Integers ${wait_resp} ${resp_code}

View File

@@ -95,15 +95,11 @@ class simple_REST:
| *Set Body* | {"name":"test"} |
| *POST request* | http://10.10.10.1:8082/environments |
"""
LOG.debug(url)
LOG.debug(self.headers)
LOG.debug(self.body)
self.response = requests.request('POST', url,
headers=self.headers,
data=str(self.body))
LOG.debug(self.response.text)
def POST_request_wo_body (self, url):
def POST_request_without_body(self, url):
"""
This function allows to send POST requests
@@ -113,11 +109,8 @@ class simple_REST:
| *Set Body* | {"name":"test"} |
| *POST request* | http://10.10.10.1:8082/environments |
"""
LOG.debug(url)
LOG.debug(self.headers)
self.response = requests.request('POST', url,
headers=self.headers)
LOG.debug(self.response.text)
def DELETE_request(self, url):
"""
@@ -128,7 +121,8 @@ class simple_REST:
| *Set Headers* | Content-Type | application/json |
| *DELETE request* | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('DELETE', url=url, headers=self.headers)
self.response = requests.request('DELETE', url=url,
headers=self.headers)
def PUT_request(self, url):
"""
@@ -138,15 +132,11 @@ class simple_REST:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *Set Body* | {"name":"test-changed"} |
| *PUT request* | http://10.10.10.1:8082/environments/368712634876 |
| *PUT request* | http://10.10.10.1:8082/634876 |
"""
LOG.debug(url)
LOG.debug(self.headers)
LOG.debug(self.body)
self.response = requests.request('PUT', url,
headers=self.headers,
data=str(self.body))
LOG.debug(self.response.text)
def get_response_code(self):
"""
@@ -178,4 +168,3 @@ class simple_REST:
except:
return_text = self.response.text
return return_text