Coverage for nova/api/openstack/compute/schemas/versions.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-17 15:08 +0000

1# Licensed under the Apache License, Version 2.0 (the "License"); you may 

2# not use this file except in compliance with the License. You may obtain 

3# a copy of the License at 

4# 

5# http://www.apache.org/licenses/LICENSE-2.0 

6# 

7# Unless required by applicable law or agreed to in writing, software 

8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

10# License for the specific language governing permissions and limitations 

11# under the License. 

12 

13# TODO(stephenfin): Remove additionalProperties in a future API version 

14show_query = { 

15 'type': 'object', 

16 'properties': {}, 

17 'additionalProperties': True, 

18} 

19 

20# TODO(stephenfin): Remove additionalProperties in a future API version 

21multi_query = { 

22 'type': 'object', 

23 'properties': {}, 

24 'additionalProperties': True, 

25} 

26 

27_version_obj = { 

28 'type': 'object', 

29 'properties': { 

30 'id': {'type': 'string'}, 

31 'status': { 

32 'type': 'string', 

33 'enum': ['CURRENT', 'SUPPORTED', 'DEPRECATED'], 

34 }, 

35 'links': { 

36 'type': 'array', 

37 'items': { 

38 'type': 'object', 

39 'properties': { 

40 'href': {'type': 'string'}, 

41 'rel': {'type': 'string'}, 

42 'type': {'type': 'string'}, 

43 }, 

44 'required': ['rel', 'href'], 

45 'additionalProperties': False, 

46 }, 

47 }, 

48 'min_version': {'type': 'string'}, 

49 'updated': {'type': 'string', 'format': 'date-time'}, 

50 'version': {'type': 'string'}, 

51 }, 

52 'required': ['id', 'status', 'links', 'min_version', 'updated'], 

53 'additionalProperties': False, 

54} 

55 

56index_response = { 

57 'type': 'object', 

58 'properties': { 

59 'versions': {'type': 'array', 'items': _version_obj} 

60 }, 

61 'required': ['versions'], 

62 'additionalProperties': False, 

63} 

64 

65_version_obj_with_media_types = _version_obj 

66_version_obj_with_media_types['properties'].update({ 

67 'media-types': { 

68 'type': 'array', 

69 'items': { 

70 'type': 'object', 

71 'properties': { 

72 'base': {'type': 'string'}, 

73 'type': {'type': 'string'}, 

74 }, 

75 'required': ['base', 'type'], 

76 'additionalProperties': False, 

77 }, 

78 } 

79}) 

80 

81show_response = { 

82 'type': 'object', 

83 'properties': { 

84 'version': _version_obj_with_media_types 

85 }, 

86 'required': ['version'], 

87 'additionalProperties': False, 

88} 

89 

90_legacy_version_obj = { 

91 'type': 'object', 

92 'properties': { 

93 'id': {'type': 'string'}, 

94 'status': {'type': 'string'}, 

95 'links': { 

96 'type': 'array', 

97 'items': { 

98 'type': 'object', 

99 'properties': { 

100 'href': {'type': 'string'}, 

101 'rel': {'type': 'string'}, 

102 'type': {'type': 'string'}, 

103 }, 

104 'required': ['rel', 'href'], 

105 'additionalProperties': False, 

106 }, 

107 }, 

108 'media-types': { 

109 'type': 'array', 

110 'items': { 

111 'type': 'object', 

112 'properties': { 

113 'base': {'type': 'string'}, 

114 'type': {'type': 'string'}, 

115 }, 

116 'required': ['base', 'type'], 

117 'additionalProperties': False, 

118 }, 

119 }, 

120 }, 

121 'required': ['id', 'status', 'links', 'media-types'], 

122 'additionalProperties': False, 

123} 

124 

125multi_response = { 

126 'type': 'object', 

127 'properties': { 

128 'choices': {'type': 'array', 'items': _legacy_version_obj} 

129 }, 

130 'required': ['choices'], 

131 'additionalProperties': False, 

132}