Coverage for manila/api/schemas/share_instance_export_locations.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2026-02-18 22:19 +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. 

12import copy 

13 

14from manila.api.validation import helpers 

15 

16metadata_response_body = { 

17 'type': 'object', 

18 'properties': { 

19 'metadata': { 

20 'type': ['object', 'null'], 

21 'patternProperties': { 

22 '^[a-zA-Z0-9-_:. ]{1,255}$': { 

23 'type': 'string', 

24 }, 

25 }, 

26 'additionalProperties': False, 

27 }, 

28 }, 

29 'required': ['metadata'], 

30 'additionalProperties': False, 

31} 

32 

33index_response_body = { 

34 "type": "object", 

35 "properties": { 

36 "export_locations": { 

37 "type": "array", 

38 "items": { 

39 "type": "object", 

40 "properties": { 

41 "id": { 

42 "type": "string", 

43 "description": helpers.description( 

44 'export_location_id', 

45 ), 

46 }, 

47 "share_instance_id": { 

48 "type": "string", 

49 "description": helpers.description( 

50 'export_location_share_instance_id', 

51 ), 

52 }, 

53 "path": { 

54 "type": "string", 

55 "description": helpers.description( 

56 'export_location_path', 

57 ), 

58 }, 

59 "is_admin_only": { 

60 "type": "boolean", 

61 "description": helpers.description( 

62 'export_location_is_admin_only', 

63 ), 

64 }, 

65 }, 

66 "required": ["id", "path"], 

67 "additionalProperties": False, 

68 }, 

69 }, 

70 }, 

71 "required": ["export_locations"], 

72 "additionalProperties": False, 

73} 

74 

75index_response_body_v214 = copy.deepcopy(index_response_body) 

76index_response_body_v214['properties'][ 

77 'export_locations' 

78]['items']['properties'].update({ 

79 'preferred': { 

80 'type': 'boolean', 

81 'description': helpers.description('export_location_preferred'), 

82 }, 

83}) 

84 

85index_response_body_v214['properties'][ 

86 'export_locations' 

87]['items']['required'].append('preferred') 

88index_response_body_v287 = copy.deepcopy(index_response_body_v214) 

89index_response_body_v287['properties'][ 

90 'export_locations' 

91]['items']['properties'].update({ 

92 'metadata': { 

93 'type': 'object', 

94 'patternProperties': { 

95 '^[a-zA-Z0-9-_:. ]{1,255}$': { 

96 'type': 'string', 

97 }, 

98 }, 

99 'additionalProperties': False, 

100 }, 

101}) 

102index_response_body_v287['properties'][ 

103 'export_locations' 

104]['items']['required'].append('metadata') 

105show_response_body = { 

106 'type': 'object', 

107 'properties': { 

108 'export_location': { 

109 'type': 'object', 

110 'properties': { 

111 'created_at': { 

112 'type': 'string', 

113 'format': 'date-time', 

114 'readonly': True, 

115 'description': helpers.description('created_at'), 

116 }, 

117 'id': { 

118 'type': 'string', 

119 'readonly': True, 

120 'description': helpers.description( 

121 'export_location_id', 

122 ), 

123 }, 

124 'is_admin_only': { 

125 'type': 'boolean', 

126 'description': helpers.description( 

127 'export_location_is_admin_only', 

128 ), 

129 }, 

130 'path': { 

131 'type': 'string', 

132 'description': helpers.description( 

133 'export_location_path', 

134 ), 

135 }, 

136 'updated_at': { 

137 'type': 'string', 

138 'format': 'date-time', 

139 'readonly': True, 

140 'description': helpers.description('updated_at'), 

141 }, 

142 'share_instance_id': { 

143 'type': 'string', 

144 'description': helpers.description( 

145 'export_location_share_instance_id', 

146 ), 

147 }, 

148 }, 

149 'required': [ 

150 'created_at', 

151 'id', 

152 'path', 

153 'updated_at', 

154 ], 

155 'additionalProperties': False, 

156 'description': helpers.description('export_location'), 

157 }, 

158 }, 

159 'required': ['export_location'], 

160 'additionalProperties': False, 

161} 

162 

163show_response_body_v214 = copy.deepcopy(show_response_body) 

164_ex_loc = show_response_body_v214['properties']['export_location'] 

165_ex_loc['properties'].update( 

166 { 

167 'preferred': { 

168 'type': 'boolean', 

169 'description': helpers.description('export_location_preferred'), 

170 }, 

171 }, 

172) 

173_ex_loc['required'].append('preferred') 

174 

175show_response_body_v287 = copy.deepcopy(show_response_body_v214) 

176show_response_body_v287['properties']['export_location'][ 

177 'properties'].update({ 

178 'metadata': { 

179 'type': 'object', 

180 'patternProperties': { 

181 '^[a-zA-Z0-9-_:. ]{1,255}$': { 

182 'type': 'string', 

183 }, 

184 }, 

185 'additionalProperties': False, 

186 }, 

187 }, 

188) 

189show_response_body_v287['properties']['export_location'][ 

190 'required'].append('metadata')