
Use keystoneauth1's Betamax test fixture to start recording request-response interaction pairs in files. I'm starting this bit of work with our hosts API module. As a result of this testing, I discovered that we were not handling keystoneauth1 exceptions inside of our session. This adds handling for that with a new function for finding the right cratonclient exception to raise in cratonclient.exceptions. Thus, this also includes testing for the convenience functions in that module. Users need only setup 4 environment variables for testing: * CRATON_DEMO_USERNAME * CRATON_DEMO_PROJECT * CRATON_DEMO_TOKEN * CRATON_DEMO_URL Depends-On: I45de545b040d2b99ac8f3f4d3c81359615d328e8 Change-Id: Ib69d825a50a7e4179aefd11bcbfbed39c27c7fbe Partially-implements: bp testing-plan
232 lines
7.2 KiB
YAML
232 lines
7.2 KiB
YAML
http_interactions:
|
|
- recorded_at: '2017-03-21T14:50:37'
|
|
request:
|
|
body:
|
|
encoding: utf-8
|
|
string: "{\n \"name\": \"cloud-TestHosts-test_delete\"\n}"
|
|
headers:
|
|
Accept: '*/*'
|
|
Accept-Encoding: gzip, deflate
|
|
Connection: keep-alive
|
|
Content-Length: '39'
|
|
Content-Type: application/json
|
|
User-Agent: python-cratonclient/0.0.1
|
|
X-Auth-Project: <craton-demo-project>
|
|
X-Auth-Token: <craton-demo-token>
|
|
X-Auth-User: <craton-demo-username>
|
|
method: POST
|
|
uri: <craton-url>/clouds
|
|
response:
|
|
body:
|
|
encoding: null
|
|
string: "{\n \"variables\": {},\n \"id\": 10,\n \"name\": \"cloud-TestHosts-test_delete\"\
|
|
,\n \"note\": null,\n \"created_at\": \"2017-03-20T23:40:59.563744\",\n\
|
|
\ \"updated_at\": null,\n \"project_id\": \"<craton-demo-project>\"\n}"
|
|
headers:
|
|
Content-Length: '215'
|
|
Content-Type: application/json
|
|
Date: Mon, 20 Mar 2017 23:40:59 GMT
|
|
Location: <craton-url>/clouds/10
|
|
Server: WSGIServer/0.2 CPython/3.5.2
|
|
x-openstack-request-id: req-8c61f8a2-83bb-466e-8cdc-b24b38e7de74
|
|
status:
|
|
code: 201
|
|
message: CREATED
|
|
url: <craton-url>/clouds
|
|
- recorded_at: '2017-03-21T14:50:37'
|
|
request:
|
|
body:
|
|
encoding: utf-8
|
|
string: "{\n \"name\": \"region-TestHosts-test_delete\",\n \"cloud_id\": 10\n\
|
|
}"
|
|
headers:
|
|
Accept: '*/*'
|
|
Accept-Encoding: gzip, deflate
|
|
Connection: keep-alive
|
|
Content-Length: '56'
|
|
Content-Type: application/json
|
|
User-Agent: python-cratonclient/0.0.1
|
|
X-Auth-Project: <craton-demo-project>
|
|
X-Auth-Token: <craton-demo-token>
|
|
X-Auth-User: <craton-demo-username>
|
|
method: POST
|
|
uri: <craton-url>/regions
|
|
response:
|
|
body:
|
|
encoding: null
|
|
string: "{\n \"variables\": {},\n \"id\": 6,\n \"name\": \"region-TestHosts-test_delete\"\
|
|
,\n \"note\": null,\n \"created_at\": \"2017-03-20T23:40:59.702986\",\n\
|
|
\ \"updated_at\": null,\n \"cloud_id\": 10,\n \"project_id\": \"<craton-demo-project>\"\
|
|
\n}"
|
|
headers:
|
|
Content-Length: '233'
|
|
Content-Type: application/json
|
|
Date: Mon, 20 Mar 2017 23:40:59 GMT
|
|
Location: <craton-url>/regions/6
|
|
Server: WSGIServer/0.2 CPython/3.5.2
|
|
x-openstack-request-id: req-6f6bf38e-9cb4-48ac-b915-e0fec77c5d98
|
|
status:
|
|
code: 201
|
|
message: CREATED
|
|
url: <craton-url>/regions
|
|
- recorded_at: '2017-03-21T14:50:38'
|
|
request:
|
|
body:
|
|
encoding: utf-8
|
|
string: "{\n \"region_id\": 6,\n \"device_type\": \"server\",\n \"name\"\
|
|
: \"host-to-delete\",\n \"cloud_id\": 10,\n \"ip_address\": \"127.0.1.0\"\
|
|
\n}"
|
|
headers:
|
|
Accept: '*/*'
|
|
Accept-Encoding: gzip, deflate
|
|
Connection: keep-alive
|
|
Content-Length: '110'
|
|
Content-Type: application/json
|
|
User-Agent: python-cratonclient/0.0.1
|
|
X-Auth-Project: <craton-demo-project>
|
|
X-Auth-Token: <craton-demo-token>
|
|
X-Auth-User: <craton-demo-username>
|
|
method: POST
|
|
uri: <craton-url>/hosts
|
|
response:
|
|
body:
|
|
encoding: null
|
|
string: "{\n \"id\": 7,\n \"ip_address\": \"127.0.1.0\",\n \"region_id\"\
|
|
: 6,\n \"active\": true,\n \"cloud_id\": 10,\n \"project_id\": \"<craton-demo-project>\"\
|
|
,\n \"variables\": {},\n \"parent_id\": null,\n \"updated_at\": null,\n\
|
|
\ \"name\": \"host-to-delete\",\n \"cell_id\": null,\n \"device_type\"\
|
|
: \"server\",\n \"note\": null,\n \"links\": [\n {\n \"href\": \"\
|
|
<craton-url>/regions/6\",\n \"rel\": \"up\"\n }\n ],\n \"created_at\"\
|
|
: \"2017-03-20T23:40:59.817351\"\n}"
|
|
headers:
|
|
Content-Length: '451'
|
|
Content-Type: application/json
|
|
Date: Mon, 20 Mar 2017 23:40:59 GMT
|
|
Location: <craton-url>/hosts/7
|
|
Server: WSGIServer/0.2 CPython/3.5.2
|
|
x-openstack-request-id: req-0a63c2bf-492e-4bc0-a49a-438bc81b7656
|
|
status:
|
|
code: 201
|
|
message: CREATED
|
|
url: <craton-url>/hosts
|
|
- recorded_at: '2017-03-21T14:50:38'
|
|
request:
|
|
body:
|
|
encoding: utf-8
|
|
string: ''
|
|
headers:
|
|
Accept: '*/*'
|
|
Accept-Encoding: gzip, deflate
|
|
Connection: keep-alive
|
|
Content-Length: '0'
|
|
User-Agent: python-cratonclient/0.0.1
|
|
X-Auth-Project: <craton-demo-project>
|
|
X-Auth-Token: <craton-demo-token>
|
|
X-Auth-User: <craton-demo-username>
|
|
method: DELETE
|
|
uri: <craton-url>/hosts/7
|
|
response:
|
|
body:
|
|
encoding: null
|
|
string: ''
|
|
headers:
|
|
Content-Length: '0'
|
|
Content-Type: application/json
|
|
Date: Mon, 20 Mar 2017 23:40:59 GMT
|
|
Server: WSGIServer/0.2 CPython/3.5.2
|
|
x-openstack-request-id: req-269e2521-d1d5-4312-a415-b2e8b7a91e6e
|
|
status:
|
|
code: 204
|
|
message: NO CONTENT
|
|
url: <craton-url>/hosts/7
|
|
- recorded_at: '2017-03-21T14:50:38'
|
|
request:
|
|
body:
|
|
encoding: utf-8
|
|
string: ''
|
|
headers:
|
|
Accept: '*/*'
|
|
Accept-Encoding: gzip, deflate
|
|
Connection: keep-alive
|
|
User-Agent: python-cratonclient/0.0.1
|
|
X-Auth-Project: <craton-demo-project>
|
|
X-Auth-Token: <craton-demo-token>
|
|
X-Auth-User: <craton-demo-username>
|
|
method: GET
|
|
uri: <craton-url>/hosts/7
|
|
response:
|
|
body:
|
|
encoding: utf-8
|
|
string: '{"status": 404, "message": "Not Found"}'
|
|
headers:
|
|
Content-Length: '46'
|
|
Content-Type: text/html; charset=utf-8
|
|
Date: Mon, 20 Mar 2017 23:41:00 GMT
|
|
Server: WSGIServer/0.2 CPython/3.5.2
|
|
x-openstack-request-id: req-3ae97e93-0cca-4e97-afad-3ac4312d19b1
|
|
status:
|
|
code: 404
|
|
message: NOT FOUND
|
|
url: <craton-url>/hosts/7
|
|
- recorded_at: '2017-03-21T14:50:38'
|
|
request:
|
|
body:
|
|
encoding: utf-8
|
|
string: ''
|
|
headers:
|
|
Accept: '*/*'
|
|
Accept-Encoding: gzip, deflate
|
|
Connection: keep-alive
|
|
Content-Length: '0'
|
|
User-Agent: python-cratonclient/0.0.1
|
|
X-Auth-Project: <craton-demo-project>
|
|
X-Auth-Token: <craton-demo-token>
|
|
X-Auth-User: <craton-demo-username>
|
|
method: DELETE
|
|
uri: <craton-url>/regions/6
|
|
response:
|
|
body:
|
|
encoding: null
|
|
string: ''
|
|
headers:
|
|
Content-Length: '0'
|
|
Content-Type: application/json
|
|
Date: Mon, 20 Mar 2017 23:41:00 GMT
|
|
Server: WSGIServer/0.2 CPython/3.5.2
|
|
x-openstack-request-id: req-dc103d8f-ddc7-45a9-a675-2a20518b2a68
|
|
status:
|
|
code: 204
|
|
message: NO CONTENT
|
|
url: <craton-url>/regions/6
|
|
- recorded_at: '2017-03-21T14:50:38'
|
|
request:
|
|
body:
|
|
encoding: utf-8
|
|
string: ''
|
|
headers:
|
|
Accept: '*/*'
|
|
Accept-Encoding: gzip, deflate
|
|
Connection: keep-alive
|
|
Content-Length: '0'
|
|
User-Agent: python-cratonclient/0.0.1
|
|
X-Auth-Project: <craton-demo-project>
|
|
X-Auth-Token: <craton-demo-token>
|
|
X-Auth-User: <craton-demo-username>
|
|
method: DELETE
|
|
uri: <craton-url>/clouds/10
|
|
response:
|
|
body:
|
|
encoding: null
|
|
string: ''
|
|
headers:
|
|
Content-Length: '0'
|
|
Content-Type: application/json
|
|
Date: Mon, 20 Mar 2017 23:41:00 GMT
|
|
Server: WSGIServer/0.2 CPython/3.5.2
|
|
x-openstack-request-id: req-332fa9fc-e12f-46e9-922b-6ec1ee9bc2b3
|
|
status:
|
|
code: 204
|
|
message: NO CONTENT
|
|
url: <craton-url>/clouds/10
|
|
recorded_with: betamax/0.8.0
|