1# Tests that the middleware does microversioning as we expect
2# The min version of the service is 1.0, the max is 1.2,
3# the service type is "cats" (because the internet is for cats).
4
5defaults:
6    request_headers:
7        # We must guard against webob requiring an accept header.
8        # We don't want to do this in the middleware itself as
9        # we don't know what the application would prefer as a
10        # default.
11        accept: application/json
12
13tests:
14
15- name: min default
16  GET: /good
17  response_headers:
18      openstack-api-version: cats 1.0
19
20- name: max latest
21  GET: /good
22  request_headers:
23      openstack-api-version: cats latest
24  response_headers:
25      openstack-api-version: cats 1.2
26
27- name: explict
28  GET: /good
29  request_headers:
30      openstack-api-version: cats 1.1
31  response_headers:
32      openstack-api-version: cats 1.1
33
34- name: out of range
35  GET: /good
36  request_headers:
37      openstack-api-version: cats 1.9
38  status: 406
39  response_strings:
40      - Unacceptable version header
41
42- name: invalid format
43  GET: /good
44  request_headers:
45      openstack-api-version: cats 1.9.5
46  status: 400
47  response_strings:
48      - invalid literal
49
50- name: different service
51  desc: end up with default microversion
52  GET: /good
53  request_headers:
54      openstack-api-version: dogs 1.9
55  response_headers:
56      openstack-api-version: cats 1.0
57
58- name: multiple services
59  GET: /good
60  request_headers:
61      openstack-api-version: dogs 1.9, cats 1.1
62  response_headers:
63      openstack-api-version: cats 1.1
64
65- name: header present on exception
66  GET: /bad
67  request_headers:
68      openstack-api-version: dogs 1.9, cats 1.1
69  response_headers:
70      openstack-api-version: cats 1.1
71  status: 404
72  response_strings:
73      - /bad not found
74
75
76