|
| 1 | +# Function tests for unicode support |
| 2 | + |
| 3 | +# Note: This file contains UTF-8 character sequences and must be stored UTF-8 |
| 4 | +# encoded. Make sure your editor supports and preserves the UTF-8 characters. |
| 5 | + |
| 6 | +# Note: It is not easily possible to specify invalid Unicode characters in |
| 7 | +# an editable YAML file: |
| 8 | +# - Having invalid UTF-8 byte sequences directly in the file is not a good idea |
| 9 | +# because the files need to be editable and so the editor must support and |
| 10 | +# preserve the UTF-8 byte sequences in the file. Adding such a test would |
| 11 | +# be feasible when the test file gets generated, but that has not been done. |
| 12 | +# - Using escape sequences in YAML does not easily allow to construct invalid |
| 13 | +# Unicode characters: |
| 14 | +# - "\xC2" looks like an incomplete 2-byte UTF-8 byte sequence, but is really |
| 15 | +# interpreted as Unicode character U+00C2 and is fully supported. |
| 16 | +# - "\uC2" is rejected by PyYAML when loading the test file as an invalid way |
| 17 | +# to specify an escaped Unicode character. That causes a pytest collection |
| 18 | +# error because the test file cannot be loaded. |
| 19 | +# - "\uD800" is an incomplete (lone) surrogate sequence and is tolerated by |
| 20 | +# PyYAML and json, even though it is invalid according to the Unicode |
| 21 | +# standard. It would be rejected by ruamel.yaml. There is a testcase for |
| 22 | +# that in this test file. |
| 23 | +# - Specifying binary Bytes that are invalid UTF-8 sequences (using |
| 24 | +# !!binary) is valid in YAML and loading the test file succeeds, but it gets |
| 25 | +# rejected with an invalid type (binary vs. string) when validating the |
| 26 | +# test file against its JSON schema. |
| 27 | + |
| 28 | +- name: valid_escaped_local_property_value |
| 29 | + description: Test valid escaped Unicode character in locally present property value |
| 30 | + zhmcclient_call: |
| 31 | + target: |
| 32 | + manager_attribute: consoles |
| 33 | + uri: /api/console |
| 34 | + name: "Ren\u00e9" |
| 35 | + method: get_property |
| 36 | + parameters: |
| 37 | + name: name |
| 38 | + zhmcclient_result: |
| 39 | + return: "Ren\u00E9" # U+00E9 = e accent degu |
| 40 | + |
| 41 | +- name: valid_escaped_hmc_property_value |
| 42 | + description: Test valid escaped Unicode character in property value obtained from HMC |
| 43 | + zhmcclient_call: |
| 44 | + target: |
| 45 | + manager_attribute: consoles |
| 46 | + uri: /api/console |
| 47 | + name: "Console" |
| 48 | + method: get_property |
| 49 | + parameters: |
| 50 | + name: hmc_version |
| 51 | + zhmcclient_result: |
| 52 | + return: "\u00E9" # U+00E9 = e accent degu |
| 53 | + hmc_interactions: |
| 54 | + - http_request: |
| 55 | + method: GET |
| 56 | + uri: /api/console |
| 57 | + http_response: |
| 58 | + status: 200 |
| 59 | + body: |
| 60 | + parent: null |
| 61 | + class: "console" |
| 62 | + object-uri: "/api/console" |
| 63 | + object-id: "console" |
| 64 | + name: "Console" |
| 65 | + hmc_version: "\u00E9" # U+00E9 = e accent degu |
| 66 | + |
| 67 | +- name: valid_utf8_hmc_property_value |
| 68 | + description: Test valid UTF-8 Unicode character in property value obtained from HMC |
| 69 | + zhmcclient_call: |
| 70 | + target: |
| 71 | + manager_attribute: consoles |
| 72 | + uri: /api/console |
| 73 | + name: "Console" |
| 74 | + method: get_property |
| 75 | + parameters: |
| 76 | + name: hmc_version |
| 77 | + zhmcclient_result: |
| 78 | + return: "é" # UTF-8 character directly: U+00E9 = e accent degu |
| 79 | + hmc_interactions: |
| 80 | + - http_request: |
| 81 | + method: GET |
| 82 | + uri: /api/console |
| 83 | + http_response: |
| 84 | + status: 200 |
| 85 | + body: |
| 86 | + parent: null |
| 87 | + class: "console" |
| 88 | + object-uri: "/api/console" |
| 89 | + object-id: "console" |
| 90 | + name: "Console" |
| 91 | + hmc_version: "é" # UTF-8 character directly: U+00E9 = e accent degu |
| 92 | + |
| 93 | +- name: incomplete_surrogate_hmc_property_value |
| 94 | + description: Test incomplete Unicode surrogate sequence in property value obtained from HMC |
| 95 | + # Note: This testcase depends on using PyYAML, which tolerates incomplete |
| 96 | + # surrogate sequences (ruamel.yaml does not). |
| 97 | + zhmcclient_call: |
| 98 | + target: |
| 99 | + manager_attribute: consoles |
| 100 | + uri: /api/console |
| 101 | + name: "Console" |
| 102 | + method: get_property |
| 103 | + parameters: |
| 104 | + name: hmc_version |
| 105 | + zhmcclient_result: |
| 106 | + return: "\uD800" # incomplete (lone) Unicode surrogate sequence |
| 107 | + hmc_interactions: |
| 108 | + - http_request: |
| 109 | + method: GET |
| 110 | + uri: /api/console |
| 111 | + http_response: |
| 112 | + status: 200 |
| 113 | + body: |
| 114 | + parent: null |
| 115 | + class: "console" |
| 116 | + object-uri: "/api/console" |
| 117 | + object-id: "console" |
| 118 | + name: "Console" |
| 119 | + hmc_version: "\uD800" # incomplete (lone) Unicode surrogate sequence |
0 commit comments