python-cratonclient/cratonclient/tests/cassettes/TestHosts-test_create.yaml
Ian Cordasco a510d64cec Add Betamax for testing
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
2017-03-21 10:27:33 -05:00

202 lines
6.4 KiB
YAML

http_interactions:
- recorded_at: '2017-03-21T14:50:37'
request:
body:
encoding: utf-8
string: "{\n \"name\": \"cloud-TestHosts-test_create\"\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\": 6,\n \"name\": \"cloud-TestHosts-test_create\"\
,\n \"note\": null,\n \"created_at\": \"2017-03-20T23:40:58.854217\",\n\
\ \"updated_at\": null,\n \"project_id\": \"<craton-demo-project>\"\n}"
headers:
Content-Length: '214'
Content-Type: application/json
Date: Mon, 20 Mar 2017 23:40:58 GMT
Location: <craton-url>/clouds/6
Server: WSGIServer/0.2 CPython/3.5.2
x-openstack-request-id: req-1993267c-c04e-482d-a2f7-5a3199f45fe3
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_create\",\n \"cloud_id\": 6\n\
}"
headers:
Accept: '*/*'
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: '55'
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\": 2,\n \"name\": \"region-TestHosts-test_create\"\
,\n \"note\": null,\n \"created_at\": \"2017-03-20T23:40:58.893218\",\n\
\ \"updated_at\": null,\n \"cloud_id\": 6,\n \"project_id\": \"<craton-demo-project>\"\
\n}"
headers:
Content-Length: '232'
Content-Type: application/json
Date: Mon, 20 Mar 2017 23:40:58 GMT
Location: <craton-url>/regions/2
Server: WSGIServer/0.2 CPython/3.5.2
x-openstack-request-id: req-aa293966-07d6-4832-b294-68d277e7266c
status:
code: 201
message: CREATED
url: <craton-url>/regions
- recorded_at: '2017-03-21T14:50:37'
request:
body:
encoding: utf-8
string: "{\n \"region_id\": 2,\n \"device_type\": \"server\",\n \"name\"\
: \"host-0\",\n \"cloud_id\": 6,\n \"ip_address\": \"127.0.1.0\"\n}"
headers:
Accept: '*/*'
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: '101'
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\": 2,\n \"ip_address\": \"127.0.1.0\",\n \"region_id\"\
: 2,\n \"active\": true,\n \"cloud_id\": 6,\n \"project_id\": \"<craton-demo-project>\"\
,\n \"variables\": {},\n \"parent_id\": null,\n \"updated_at\": null,\n\
\ \"name\": \"host-0\",\n \"cell_id\": null,\n \"device_type\": \"server\"\
,\n \"note\": null,\n \"links\": [\n {\n \"href\": \"<craton-url>/regions/2\"\
,\n \"rel\": \"up\"\n }\n ],\n \"created_at\": \"2017-03-20T23:40:58.952662\"\
\n}"
headers:
Content-Length: '442'
Content-Type: application/json
Date: Mon, 20 Mar 2017 23:40:58 GMT
Location: <craton-url>/hosts/2
Server: WSGIServer/0.2 CPython/3.5.2
x-openstack-request-id: req-98391187-c6e9-4002-936c-ba3b93ee4081
status:
code: 201
message: CREATED
url: <craton-url>/hosts
- recorded_at: '2017-03-21T14:50:37'
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/2
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-949fad55-ce5e-47fb-8277-13d6f88286a2
status:
code: 204
message: NO CONTENT
url: <craton-url>/hosts/2
- recorded_at: '2017-03-21T14:50:37'
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/2
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-dbed3d00-6002-493f-84d0-40b572f500f1
status:
code: 204
message: NO CONTENT
url: <craton-url>/regions/2
- recorded_at: '2017-03-21T14:50:37'
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/6
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-f70acbe0-739f-4bba-9f56-707032a3211d
status:
code: 204
message: NO CONTENT
url: <craton-url>/clouds/6
recorded_with: betamax/0.8.0