From 2e45b95a8f9e0c1b4c7c985f01b4928bd8818a07 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Mon, 5 Sep 2016 14:09:42 +0000 Subject: [PATCH] [placement] Add some tests ensuring unicode resource provider info Add some gabbi tests which demonstrate that it is possible to create and query a resource provider that has a name that is outside the bounds of ascii. The tests using a 4byte wide utf-8 character are left as xfails because not all installations of mysql will support it. Also confirm that if a unicode characters (uri-encoded or not) in the uuid part of a resource providers path will result in the expected 404 and not explode. Closes-Bug: #1621605 Change-Id: I3d906c3296aa28b595fcc23c448c1744972c319d --- .../openstack/placement/gabbits/unicode.yaml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 nova/tests/functional/api/openstack/placement/gabbits/unicode.yaml diff --git a/nova/tests/functional/api/openstack/placement/gabbits/unicode.yaml b/nova/tests/functional/api/openstack/placement/gabbits/unicode.yaml new file mode 100644 index 000000000000..113c5158ee17 --- /dev/null +++ b/nova/tests/functional/api/openstack/placement/gabbits/unicode.yaml @@ -0,0 +1,72 @@ + +fixtures: + - APIFixture + +defaults: + request_headers: + accept: application/json + x-auth-token: admin + +tests: + +- name: get a raw snowman unicode + desc: this should fall through to a NotFound on the resource provider object + GET: /resource_providers/☃ + status: 404 + +- name: get an encoded snowman + desc: this should fall through to a NotFound on the resource provider object + GET: /resources_providers/%e2%98%83 + status: 404 + +- name: post resource provider with snowman + POST: /resource_providers + request_headers: + content-type: application/json + data: + name: ☃ + uuid: $ENVIRON['RP_UUID'] + status: 201 + response_headers: + location: //resource_providers/[a-f0-9-]+/ + +- name: get that resource provider + GET: $LOCATION + response_json_paths: + $.name: ☃ + +- name: query by name + GET: /resource_providers?name=%e2%98%83 + response_json_paths: + $.resource_providers[0].name: ☃ + +- name: delete that one + DELETE: /resource_providers/$ENVIRON['RP_UUID'] + status: 204 + +# These next three are expected to fail on many mysql +# installations. It works with the local in-RAM sqlite +# test database. +- name: four byte utf8 smiley + xfail: true + POST: /resource_providers + request_headers: + content-type: application/json + data: + name: "\U0001F601" + uuid: $ENVIRON['RP_UUID'] + status: 201 + response_headers: + location: //resource_providers/[a-f0-9-]+/ + +- name: get that wide resource provider + xfail: true + GET: $LOCATION + response_json_paths: + $.name: "\U0001F601" + +- name: query by wide name + xfail: true + GET: /resource_providers?name=%F0%9F%98%81 + response_json_paths: + $.resource_providers[0].name: "\U0001F601"