summaryrefslogtreecommitdiff
path: root/nova/tests/functional/api/openstack/placement/gabbits/basic-http.yaml
blob: 1c0dd6fcc5f1bad7f026f4d1a0302a9f407b48f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#
# Test the basic handling of HTTP (expected response codes and the
# like).
#

fixtures:
    - APIFixture

defaults:
    request_headers:
        # NOTE(cdent): Get past keystone, even though at this stage
        # we don't require auth.
        x-auth-token: admin
        accept: application/json

tests:
- name: 404 at no service
  GET: /barnabas
  status: 404
  response_json_paths:
      $.errors[0].title: Not Found

- name: error message has request id
  GET: /barnabas
  status: 404
  response_json_paths:
      $.errors[0].request_id: /req-[a-fA-F0-9-]+/

- name: 404 at no resource provider
  GET: /resource_providers/fd0dd55c-6330-463b-876c-31c54e95cb95
  status: 404

- name: 405 on bad method at root
  DELETE: /
  status: 405
  response_headers:
      allow: GET
  response_json_paths:
      $.errors[0].title: Method Not Allowed

- name: 200 at home
  GET: /
  status: 200

- name: 405 on bad method on app
  DELETE: /resource_providers
  status: 405
  response_headers:
      allow: /(GET|POST), (POST|GET)/
  response_json_paths:
      $.errors[0].title: Method Not Allowed
  response_strings:
    - The method DELETE is not allowed for this resource.

- name: 405 on bad options method on app
  OPTIONS: /resource_providers
  status: 405
  response_headers:
      allow: /(GET|POST), (POST|GET)/
  response_json_paths:
      $.errors[0].title: Method Not Allowed
  response_strings:
    - The method OPTIONS is not allowed for this resource.

- name: bad accept resource providers
  GET: /resource_providers
  request_headers:
      accept: text/plain
  status: 406

- name: complex accept resource providers
  GET: /resource_providers
  request_headers:
      accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  status: 200
  response_json_paths:
      $.resource_providers: []

- name: post resource provider wrong content-type
  POST: /resource_providers
  request_headers:
    content-type: text/plain
  data: I want a resource provider please
  status: 415

- name: post resource provider missing content-type
  desc: because content-length is set, we should have a content-type
  POST: /resource_providers
  data: I want a resource provider please
  status: 400
  response_strings:
      - content-type header required

# NOTE(cdent): This is an awkward test. It is not actually testing a
# PUT of a resource provider. It is confirming that a PUT with no
# body, no content-length header and no content-type header will
# reach the desired handler.
- name: PUT resource provider no body
  desc: different response string from prior test indicates past content-length requirement
  PUT: /resource_providers/d3a64825-8228-4ccb-8a6c-1c6d3eb6a3e8
  status: 415
  response_strings:
      - The media type None is not supported, use application/json

- name: post resource provider schema mismatch
  POST: /resource_providers
  request_headers:
      content-type: application/json
  data:
      transport: car
      color: blue
  status: 400

- name: post good resource provider
  POST: /resource_providers
  request_headers:
    content-type: application/json
  data:
      name: $ENVIRON['RP_NAME']
      uuid: $ENVIRON['RP_UUID']
  status: 201

- name: get resource provider wrong accept
  GET: /resource_providers/$ENVIRON['RP_UUID']
  request_headers:
      accept: text/plain
  status: 406
  response_strings:
      - Only application/json is provided

- name: get resource provider complex accept wild match
  desc: like a browser, */* should match
  GET: /resource_providers/$ENVIRON['RP_UUID']
  request_headers:
      accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  response_json_paths:
      $.uuid: $ENVIRON['RP_UUID']

- name: get resource provider complex accept no match
  desc: no */*, no match
  GET: /resource_providers/$ENVIRON['RP_UUID']
  request_headers:
      accept: text/html,application/xhtml+xml,application/xml;q=0.9
  status: 406

- name: put poor format resource provider
  PUT: /resource_providers/$ENVIRON['RP_UUID']
  request_headers:
    content-type: text/plain
  data: Why U no provide?
  status: 415

- name: non inventory sub resource provider path
  GET: /resource_providers/7850178f-1807-4512-b135-0b174985405b/cows
  request_headers:
      accept: application/json
  status: 404
  response_json_paths:
      $.errors[0].title:  Not Found
  response_strings:
      - The resource could not be found.