python-openstackclient 8.3.0__py3-none-any.whl → 10.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. openstackclient/__init__.py +2 -6
  2. openstackclient/api/api.py +41 -23
  3. openstackclient/api/compute_v2.py +44 -25
  4. openstackclient/api/object_store_v1.py +75 -97
  5. openstackclient/api/volume_v2.py +2 -1
  6. openstackclient/api/volume_v3.py +2 -1
  7. openstackclient/common/availability_zone.py +58 -42
  8. openstackclient/common/clientmanager.py +56 -29
  9. openstackclient/common/configuration.py +10 -3
  10. openstackclient/common/envvars.py +2 -2
  11. openstackclient/common/extension.py +14 -5
  12. openstackclient/common/limits.py +10 -5
  13. openstackclient/common/module.py +14 -6
  14. openstackclient/common/pagination.py +8 -2
  15. openstackclient/common/progressbar.py +7 -6
  16. openstackclient/common/project_cleanup.py +13 -7
  17. openstackclient/common/quota.py +126 -114
  18. openstackclient/common/versions.py +8 -2
  19. openstackclient/compute/client.py +7 -3
  20. openstackclient/compute/v2/agent.py +17 -10
  21. openstackclient/compute/v2/aggregate.py +36 -22
  22. openstackclient/compute/v2/console.py +14 -8
  23. openstackclient/compute/v2/console_connection.py +11 -3
  24. openstackclient/compute/v2/flavor.py +39 -21
  25. openstackclient/compute/v2/host.py +14 -6
  26. openstackclient/compute/v2/hypervisor.py +14 -5
  27. openstackclient/compute/v2/hypervisor_stats.py +10 -2
  28. openstackclient/compute/v2/keypair.py +29 -14
  29. openstackclient/compute/v2/server.py +251 -171
  30. openstackclient/compute/v2/server_backup.py +10 -4
  31. openstackclient/compute/v2/server_event.py +21 -12
  32. openstackclient/compute/v2/server_group.py +21 -11
  33. openstackclient/compute/v2/server_image.py +19 -10
  34. openstackclient/compute/v2/server_migration.py +24 -10
  35. openstackclient/compute/v2/server_share.py +274 -0
  36. openstackclient/compute/v2/server_volume.py +10 -4
  37. openstackclient/compute/v2/service.py +14 -7
  38. openstackclient/compute/v2/usage.py +26 -21
  39. openstackclient/identity/client.py +8 -3
  40. openstackclient/identity/common.py +103 -41
  41. openstackclient/identity/v2_0/catalog.py +14 -7
  42. openstackclient/identity/v2_0/ec2creds.py +21 -10
  43. openstackclient/identity/v2_0/endpoint.py +23 -11
  44. openstackclient/identity/v2_0/project.py +25 -14
  45. openstackclient/identity/v2_0/role.py +28 -14
  46. openstackclient/identity/v2_0/role_assignment.py +9 -3
  47. openstackclient/identity/v2_0/service.py +26 -12
  48. openstackclient/identity/v2_0/token.py +12 -5
  49. openstackclient/identity/v2_0/user.py +26 -15
  50. openstackclient/identity/v3/access_rule.py +26 -12
  51. openstackclient/identity/v3/application_credential.py +59 -24
  52. openstackclient/identity/v3/catalog.py +14 -7
  53. openstackclient/identity/v3/consumer.py +22 -11
  54. openstackclient/identity/v3/credential.py +36 -16
  55. openstackclient/identity/v3/domain.py +37 -18
  56. openstackclient/identity/v3/ec2creds.py +25 -12
  57. openstackclient/identity/v3/endpoint.py +42 -20
  58. openstackclient/identity/v3/endpoint_group.py +28 -17
  59. openstackclient/identity/v3/federation_protocol.py +71 -50
  60. openstackclient/identity/v3/group.py +55 -32
  61. openstackclient/identity/v3/identity_provider.py +92 -57
  62. openstackclient/identity/v3/implied_role.py +21 -9
  63. openstackclient/identity/v3/limit.py +115 -92
  64. openstackclient/identity/v3/mapping.py +26 -13
  65. openstackclient/identity/v3/policy.py +23 -12
  66. openstackclient/identity/v3/project.py +211 -122
  67. openstackclient/identity/v3/region.py +36 -16
  68. openstackclient/identity/v3/registered_limit.py +116 -109
  69. openstackclient/identity/v3/role.py +61 -31
  70. openstackclient/identity/v3/role_assignment.py +23 -6
  71. openstackclient/identity/v3/service.py +36 -16
  72. openstackclient/identity/v3/service_provider.py +37 -15
  73. openstackclient/identity/v3/tag.py +23 -17
  74. openstackclient/identity/v3/token.py +30 -14
  75. openstackclient/identity/v3/trust.py +32 -14
  76. openstackclient/identity/v3/unscoped_saml.py +10 -2
  77. openstackclient/identity/v3/user.py +49 -26
  78. openstackclient/image/client.py +7 -3
  79. openstackclient/image/v1/image.py +33 -26
  80. openstackclient/image/v2/cache.py +14 -9
  81. openstackclient/image/v2/image.py +76 -49
  82. openstackclient/image/v2/info.py +7 -1
  83. openstackclient/image/v2/metadef_namespaces.py +109 -13
  84. openstackclient/image/v2/metadef_objects.py +28 -15
  85. openstackclient/image/v2/metadef_properties.py +24 -13
  86. openstackclient/image/v2/metadef_resource_type_association.py +14 -7
  87. openstackclient/image/v2/metadef_resource_types.py +7 -1
  88. openstackclient/image/v2/task.py +15 -6
  89. openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +7 -192
  90. openstackclient/network/client.py +7 -2
  91. openstackclient/network/common.py +16 -241
  92. openstackclient/network/utils.py +36 -22
  93. openstackclient/network/v2/address_group.py +27 -16
  94. openstackclient/network/v2/address_scope.py +24 -13
  95. openstackclient/network/v2/bgpvpn/bgpvpn.py +463 -0
  96. openstackclient/network/v2/bgpvpn/constants.py +30 -0
  97. openstackclient/network/v2/bgpvpn/network_association.py +214 -0
  98. openstackclient/network/v2/bgpvpn/port_association.py +490 -0
  99. openstackclient/network/v2/bgpvpn/router_association.py +288 -0
  100. openstackclient/network/v2/default_security_group_rule.py +19 -10
  101. openstackclient/network/v2/floating_ip.py +110 -159
  102. openstackclient/network/v2/floating_ip_port_forwarding.py +30 -18
  103. openstackclient/network/v2/fwaas/__init__.py +0 -0
  104. openstackclient/network/v2/fwaas/group.py +466 -0
  105. openstackclient/network/v2/fwaas/policy.py +518 -0
  106. openstackclient/network/v2/fwaas/rule.py +574 -0
  107. openstackclient/network/v2/ip_availability.py +13 -5
  108. openstackclient/network/v2/l3_conntrack_helper.py +22 -13
  109. openstackclient/network/v2/local_ip.py +24 -13
  110. openstackclient/network/v2/local_ip_association.py +14 -7
  111. openstackclient/network/v2/ndp_proxy.py +20 -11
  112. openstackclient/network/v2/network.py +129 -196
  113. openstackclient/network/v2/network_agent.py +46 -25
  114. openstackclient/network/v2/network_auto_allocated_topology.py +22 -11
  115. openstackclient/network/v2/network_flavor.py +27 -16
  116. openstackclient/network/v2/network_flavor_profile.py +23 -12
  117. openstackclient/network/v2/network_meter.py +21 -10
  118. openstackclient/network/v2/network_meter_rule.py +21 -11
  119. openstackclient/network/v2/network_qos_policy.py +25 -15
  120. openstackclient/network/v2/network_qos_rule.py +32 -17
  121. openstackclient/network/v2/network_qos_rule_type.py +13 -5
  122. openstackclient/network/v2/network_rbac.py +23 -12
  123. openstackclient/network/v2/network_segment.py +20 -11
  124. openstackclient/network/v2/network_segment_range.py +56 -29
  125. openstackclient/network/v2/network_service_provider.py +7 -1
  126. openstackclient/network/v2/network_trunk.py +38 -22
  127. openstackclient/network/v2/port.py +54 -29
  128. openstackclient/network/v2/router.py +75 -52
  129. openstackclient/network/v2/security_group.py +87 -157
  130. openstackclient/network/v2/security_group_rule.py +100 -280
  131. openstackclient/network/v2/subnet.py +49 -28
  132. openstackclient/network/v2/subnet_pool.py +30 -17
  133. openstackclient/network/v2/taas/tap_flow.py +22 -11
  134. openstackclient/network/v2/taas/tap_mirror.py +22 -11
  135. openstackclient/network/v2/taas/tap_service.py +23 -12
  136. openstackclient/object/client.py +7 -2
  137. openstackclient/object/v1/account.py +13 -6
  138. openstackclient/object/v1/container.py +25 -15
  139. openstackclient/object/v1/object.py +25 -15
  140. openstackclient/py.typed +0 -0
  141. openstackclient/shell.py +46 -10
  142. openstackclient/tests/functional/base.py +55 -20
  143. openstackclient/tests/functional/common/test_extension.py +4 -0
  144. openstackclient/tests/functional/common/test_quota.py +3 -1
  145. openstackclient/tests/functional/compute/v2/common.py +14 -13
  146. openstackclient/tests/functional/compute/v2/test_flavor.py +3 -1
  147. openstackclient/tests/functional/compute/v2/test_server.py +3 -0
  148. openstackclient/tests/functional/identity/v2/common.py +10 -6
  149. openstackclient/tests/functional/identity/v2/test_role.py +4 -4
  150. openstackclient/tests/functional/identity/v3/common.py +25 -19
  151. openstackclient/tests/functional/identity/v3/test_group.py +20 -20
  152. openstackclient/tests/functional/identity/v3/test_idp.py +3 -1
  153. openstackclient/tests/functional/identity/v3/test_limit.py +47 -0
  154. openstackclient/tests/functional/identity/v3/test_project.py +10 -10
  155. openstackclient/tests/functional/identity/v3/test_role.py +18 -18
  156. openstackclient/tests/functional/identity/v3/test_role_assignment.py +12 -12
  157. openstackclient/tests/functional/identity/v3/test_user.py +8 -8
  158. openstackclient/tests/functional/image/base.py +1 -6
  159. openstackclient/tests/functional/image/v2/test_metadef_objects.py +69 -0
  160. openstackclient/tests/functional/network/v2/common.py +5 -2
  161. openstackclient/tests/functional/network/v2/test_floating_ip.py +10 -4
  162. openstackclient/tests/functional/network/v2/test_ip_availability.py +4 -0
  163. openstackclient/tests/functional/network/v2/test_network_meter_rule.py +3 -2
  164. openstackclient/tests/functional/network/v2/test_network_segment.py +5 -0
  165. openstackclient/tests/functional/network/v2/test_subnet.py +13 -9
  166. openstackclient/tests/functional/object/v1/common.py +4 -0
  167. openstackclient/tests/functional/volume/v2/common.py +4 -0
  168. openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +27 -11
  169. openstackclient/tests/functional/volume/v2/test_volume_type.py +2 -2
  170. openstackclient/tests/functional/volume/v3/common.py +4 -0
  171. openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +56 -138
  172. openstackclient/tests/functional/volume/v3/test_volume_type.py +2 -2
  173. openstackclient/tests/unit/common/test_availability_zone.py +35 -49
  174. openstackclient/tests/unit/common/test_extension.py +2 -2
  175. openstackclient/tests/unit/common/test_module.py +12 -7
  176. openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
  177. openstackclient/tests/unit/common/test_quota.py +62 -23
  178. openstackclient/tests/unit/compute/v2/fakes.py +25 -0
  179. openstackclient/tests/unit/compute/v2/test_flavor.py +28 -2
  180. openstackclient/tests/unit/compute/v2/test_keypair.py +6 -6
  181. openstackclient/tests/unit/compute/v2/test_server.py +17 -104
  182. openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
  183. openstackclient/tests/unit/identity/v3/fakes.py +3 -0
  184. openstackclient/tests/unit/identity/v3/test_group.py +4 -14
  185. openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
  186. openstackclient/tests/unit/identity/v3/test_limit.py +197 -145
  187. openstackclient/tests/unit/identity/v3/test_project.py +831 -512
  188. openstackclient/tests/unit/identity/v3/test_protocol.py +97 -88
  189. openstackclient/tests/unit/identity/v3/test_registered_limit.py +355 -220
  190. openstackclient/tests/unit/identity/v3/test_user.py +4 -4
  191. openstackclient/tests/unit/image/v2/test_image.py +16 -16
  192. openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +105 -6
  193. openstackclient/tests/unit/network/test_common.py +0 -155
  194. openstackclient/tests/unit/network/v2/bgpvpn/__init__.py +0 -0
  195. openstackclient/tests/unit/network/v2/bgpvpn/fakes.py +179 -0
  196. openstackclient/tests/unit/network/v2/bgpvpn/test_bgpvpn.py +584 -0
  197. openstackclient/tests/unit/network/v2/bgpvpn/test_network_association.py +285 -0
  198. openstackclient/tests/unit/network/v2/bgpvpn/test_port_association.py +384 -0
  199. openstackclient/tests/unit/network/v2/bgpvpn/test_router_association.py +297 -0
  200. openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
  201. openstackclient/tests/unit/network/v2/fwaas/test_group.py +897 -0
  202. openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
  203. openstackclient/tests/unit/network/v2/fwaas/test_rule.py +980 -0
  204. openstackclient/tests/unit/network/v2/taas/{test_osc_tap_flow.py → test_tap_flow.py} +18 -25
  205. openstackclient/tests/unit/network/v2/taas/{test_osc_tap_mirror.py → test_tap_mirror.py} +19 -29
  206. openstackclient/tests/unit/network/v2/taas/{test_osc_tap_service.py → test_tap_service.py} +19 -29
  207. openstackclient/tests/unit/network/v2/test_address_group.py +2 -2
  208. openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +3 -2
  209. openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +13 -13
  210. openstackclient/tests/unit/network/v2/test_network_agent.py +8 -4
  211. openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
  212. openstackclient/tests/unit/network/v2/test_network_flavor.py +2 -2
  213. openstackclient/tests/unit/network/v2/test_network_qos_policy.py +1 -1
  214. openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
  215. openstackclient/tests/unit/network/v2/test_network_rbac.py +1 -1
  216. openstackclient/tests/unit/network/v2/test_network_segment.py +1 -1
  217. openstackclient/tests/unit/network/v2/test_network_segment_range.py +7 -10
  218. openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
  219. openstackclient/tests/unit/network/v2/test_router.py +8 -9
  220. openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +1 -20
  221. openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +7 -41
  222. openstackclient/tests/unit/network/v2/test_subnet.py +2 -1
  223. openstackclient/tests/unit/network/v2/test_subnet_pool.py +2 -1
  224. openstackclient/tests/unit/object/v1/fakes.py +8 -7
  225. openstackclient/tests/unit/object/v1/test_container.py +65 -101
  226. openstackclient/tests/unit/object/v1/test_container_all.py +8 -1
  227. openstackclient/tests/unit/object/v1/test_object.py +44 -84
  228. openstackclient/tests/unit/object/v1/test_object_all.py +8 -1
  229. openstackclient/tests/unit/test_hacking.py +108 -0
  230. openstackclient/tests/unit/volume/v2/fakes.py +1 -0
  231. openstackclient/tests/unit/volume/v2/test_consistency_group.py +8 -2
  232. openstackclient/tests/unit/volume/v2/test_volume.py +7 -6
  233. openstackclient/tests/unit/volume/v2/test_volume_backup.py +1 -5
  234. openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +2 -1
  235. openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
  236. openstackclient/tests/unit/volume/v3/fakes.py +1 -0
  237. openstackclient/tests/unit/volume/v3/test_volume.py +94 -15
  238. openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
  239. openstackclient/tests/unit/volume/v3/test_volume_backup.py +1 -5
  240. openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +55 -1
  241. openstackclient/tests/unit/volume/v3/test_volume_type.py +2 -4
  242. openstackclient/volume/client.py +7 -3
  243. openstackclient/volume/v2/backup_record.py +15 -6
  244. openstackclient/volume/v2/consistency_group.py +37 -25
  245. openstackclient/volume/v2/consistency_group_snapshot.py +27 -12
  246. openstackclient/volume/v2/qos_specs.py +30 -19
  247. openstackclient/volume/v2/service.py +17 -6
  248. openstackclient/volume/v2/volume.py +69 -34
  249. openstackclient/volume/v2/volume_backend.py +19 -6
  250. openstackclient/volume/v2/volume_backup.py +48 -22
  251. openstackclient/volume/v2/volume_host.py +6 -4
  252. openstackclient/volume/v2/volume_snapshot.py +52 -26
  253. openstackclient/volume/v2/volume_transfer_request.py +33 -15
  254. openstackclient/volume/v2/volume_type.py +46 -27
  255. openstackclient/volume/v3/block_storage_cleanup.py +11 -3
  256. openstackclient/volume/v3/block_storage_cluster.py +19 -7
  257. openstackclient/volume/v3/block_storage_log_level.py +15 -6
  258. openstackclient/volume/v3/block_storage_manage.py +10 -4
  259. openstackclient/volume/v3/block_storage_resource_filter.py +17 -5
  260. openstackclient/volume/v3/service.py +16 -6
  261. openstackclient/volume/v3/volume.py +103 -46
  262. openstackclient/volume/v3/volume_attachment.py +43 -21
  263. openstackclient/volume/v3/volume_backup.py +55 -26
  264. openstackclient/volume/v3/volume_group.py +23 -13
  265. openstackclient/volume/v3/volume_group_snapshot.py +32 -13
  266. openstackclient/volume/v3/volume_group_type.py +26 -13
  267. openstackclient/volume/v3/volume_message.py +15 -7
  268. openstackclient/volume/v3/volume_snapshot.py +71 -34
  269. openstackclient/volume/v3/volume_transfer_request.py +33 -15
  270. openstackclient/volume/v3/volume_type.py +45 -27
  271. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/METADATA +6 -6
  272. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/RECORD +279 -267
  273. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/WHEEL +1 -1
  274. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/entry_points.txt +53 -1
  275. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/AUTHORS +9 -0
  276. python_openstackclient-10.0.0.dist-info/pbr.json +1 -0
  277. openstackclient/api/image_v1.py +0 -69
  278. openstackclient/api/image_v2.py +0 -79
  279. openstackclient/network/v2/floating_ip_pool.py +0 -38
  280. openstackclient/tests/functional/image/v1/test_image.py +0 -97
  281. openstackclient/tests/unit/api/test_image_v1.py +0 -96
  282. openstackclient/tests/unit/api/test_image_v2.py +0 -96
  283. openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +0 -248
  284. openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +0 -49
  285. openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +0 -39
  286. openstackclient/tests/unit/network/v2/test_network_compute.py +0 -404
  287. openstackclient/tests/unit/network/v2/test_security_group_compute.py +0 -392
  288. openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +0 -555
  289. python_openstackclient-8.3.0.dist-info/pbr.json +0 -1
  290. /openstackclient/{tests/functional/image/v1 → network/v2/bgpvpn}/__init__.py +0 -0
  291. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/LICENSE +0 -0
  292. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/top_level.txt +0 -0
@@ -333,7 +333,7 @@ class TestCreateNetworkSegmentRange(TestNetworkSegmentRange):
333
333
  'shared': self._network_segment_range.shared,
334
334
  'project_id': mock.ANY,
335
335
  'network_type': self._network_segment_range.network_type,
336
- 'physical_network': self._network_segment_range.physical_network, # noqa: E501
336
+ 'physical_network': self._network_segment_range.physical_network,
337
337
  'minimum': self._network_segment_range.minimum,
338
338
  'maximum': self._network_segment_range.maximum,
339
339
  'name': self._network_segment_range.name,
@@ -450,10 +450,7 @@ class TestListNetworkSegmentRange(TestNetworkSegmentRange):
450
450
  'Minimum ID',
451
451
  'Maximum ID',
452
452
  )
453
- columns_long = columns + (
454
- 'Used',
455
- 'Available',
456
- )
453
+ columns_long = (*columns, 'Used', 'Available')
457
454
 
458
455
  data = []
459
456
  for _network_segment_range in _network_segment_ranges:
@@ -544,11 +541,11 @@ class TestSetNetworkSegmentRange(TestNetworkSegmentRange):
544
541
  # The network segment range updated.
545
542
  minimum_updated = _network_segment_range.minimum - 5
546
543
  maximum_updated = _network_segment_range.maximum + 5
547
- available_updated = (
548
- list(range(minimum_updated, 104))
549
- + [105]
550
- + list(range(107, maximum_updated + 1))
551
- )
544
+ available_updated = [
545
+ *list(range(minimum_updated, 104)),
546
+ 105,
547
+ *list(range(107, maximum_updated + 1)),
548
+ ]
552
549
  _network_segment_range_updated = (
553
550
  network_fakes.create_one_network_segment_range(
554
551
  attrs={
@@ -468,7 +468,7 @@ class TestListNetworkTrunk(TestNetworkTrunk):
468
468
  )
469
469
 
470
470
  columns = ('ID', 'Name', 'Parent Port', 'Description')
471
- columns_long = columns + ('Status', 'State', 'Created At', 'Updated At')
471
+ columns_long = (*columns, 'Status', 'State', 'Created At', 'Updated At')
472
472
  data = []
473
473
  for t in new_trunks:
474
474
  data.append((t['id'], t['name'], t['port_id'], t['description']))
@@ -711,17 +711,14 @@ class TestListRouter(TestRouter):
711
711
  'Distributed',
712
712
  'HA',
713
713
  )
714
- columns_long = columns + (
714
+ columns_long = (
715
+ *columns,
715
716
  'Routes',
716
717
  'External gateway info',
717
718
  'Availability zones',
718
719
  'Tags',
719
720
  )
720
- columns_long_no_az = columns + (
721
- 'Routes',
722
- 'External gateway info',
723
- 'Tags',
724
- )
721
+ columns_long_no_az = (*columns, 'Routes', 'External gateway info', 'Tags')
725
722
 
726
723
  data = []
727
724
  for r in routers:
@@ -824,7 +821,7 @@ class TestListRouter(TestRouter):
824
821
  with mock.patch.object(
825
822
  self.network_client, "routers", return_value=_routers
826
823
  ):
827
- columns, data = self.cmd.take_action(parsed_args)
824
+ columns, _data = self.cmd.take_action(parsed_args)
828
825
 
829
826
  self.assertNotIn("is_distributed", columns)
830
827
  self.assertNotIn("is_ha", columns)
@@ -1900,7 +1897,7 @@ class TestShowRouter(TestRouter):
1900
1897
  with mock.patch.object(
1901
1898
  self.network_client, "find_router", return_value=_router
1902
1899
  ):
1903
- columns, data = self.cmd.take_action(parsed_args)
1900
+ columns, _data = self.cmd.take_action(parsed_args)
1904
1901
 
1905
1902
  self.assertNotIn("is_distributed", columns)
1906
1903
  self.assertNotIn("is_ha", columns)
@@ -1922,7 +1919,9 @@ class TestShowRouter(TestRouter):
1922
1919
  columns, data = self.cmd.take_action(parsed_args)
1923
1920
 
1924
1921
  self.assertIn("routes", columns)
1925
- self.assertIsNone(list(data)[columns.index('routes')].human_readable())
1922
+ self.assertEqual(
1923
+ list(data)[columns.index('routes')].human_readable(), ''
1924
+ )
1926
1925
 
1927
1926
 
1928
1927
  class TestUnsetRouter(TestRouter):
@@ -299,26 +299,7 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
299
299
 
300
300
  def test_security_group_list_no_options(self):
301
301
  arglist = []
302
- verifylist = [
303
- ('all_projects', False),
304
- ]
305
- parsed_args = self.check_parser(self.cmd, arglist, verifylist)
306
-
307
- columns, data = self.cmd.take_action(parsed_args)
308
-
309
- self.network_client.security_groups.assert_called_once_with(
310
- fields=security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE
311
- )
312
- self.assertEqual(self.columns, columns)
313
- self.assertCountEqual(self.data, list(data))
314
-
315
- def test_security_group_list_all_projects(self):
316
- arglist = [
317
- '--all-projects',
318
- ]
319
- verifylist = [
320
- ('all_projects', True),
321
- ]
302
+ verifylist = []
322
303
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
323
304
 
324
305
  columns, data = self.cmd.take_action(parsed_args)
@@ -171,22 +171,6 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
171
171
  parsed_args = self.check_parser(self.cmd, arglist, [])
172
172
  self.assertEqual('IPv6', parsed_args.ethertype)
173
173
 
174
- def test_create_all_protocol_options(self):
175
- arglist = [
176
- '--protocol',
177
- 'tcp',
178
- '--proto',
179
- 'tcp',
180
- self._security_group.id,
181
- ]
182
- self.assertRaises(
183
- tests_utils.ParserException,
184
- self.check_parser,
185
- self.cmd,
186
- arglist,
187
- [],
188
- )
189
-
190
174
  def test_create_all_port_range_options(self):
191
175
  arglist = [
192
176
  '--dst-port',
@@ -251,7 +235,7 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
251
235
  self.assertEqual(self.expected_columns, columns)
252
236
  self.assertEqual(self.expected_data, data)
253
237
 
254
- def test_create_proto_option(self):
238
+ def test_create_protocol_option(self):
255
239
  self._setup_security_group_rule(
256
240
  {
257
241
  'protocol': 'icmp',
@@ -259,15 +243,14 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
259
243
  }
260
244
  )
261
245
  arglist = [
262
- '--proto',
246
+ '--protocol',
263
247
  self._security_group_rule.protocol,
264
248
  '--remote-ip',
265
249
  self._security_group_rule.remote_ip_prefix,
266
250
  self._security_group.id,
267
251
  ]
268
252
  verifylist = [
269
- ('proto', self._security_group_rule.protocol),
270
- ('protocol', None),
253
+ ('protocol', self._security_group_rule.protocol),
271
254
  ('remote_ip', self._security_group_rule.remote_ip_prefix),
272
255
  ('group', self._security_group.id),
273
256
  ]
@@ -295,15 +278,14 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
295
278
  }
296
279
  )
297
280
  arglist = [
298
- '--proto',
281
+ '--protocol',
299
282
  'any',
300
283
  '--remote-ip',
301
284
  self._security_group_rule.remote_ip_prefix,
302
285
  self._security_group.id,
303
286
  ]
304
287
  verifylist = [
305
- ('proto', 'any'),
306
- ('protocol', None),
288
+ ('protocol', 'any'),
307
289
  ('remote_ip', self._security_group_rule.remote_ip_prefix),
308
290
  ('group', self._security_group.id),
309
291
  ]
@@ -1173,22 +1155,6 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
1173
1155
  self.assertEqual(self.expected_columns_with_group, columns)
1174
1156
  self.assertEqual(self.expected_data_with_group, list(data))
1175
1157
 
1176
- def test_list_with_ignored_options(self):
1177
- self._security_group_rule_tcp.port_range_min = 80
1178
- arglist = [
1179
- '--all-projects',
1180
- ]
1181
- verifylist = [
1182
- ('all_projects', True),
1183
- ]
1184
- parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1185
-
1186
- columns, data = self.cmd.take_action(parsed_args)
1187
-
1188
- self.network_client.security_group_rules.assert_called_once_with(**{})
1189
- self.assertEqual(self.expected_columns_no_group, columns)
1190
- self.assertEqual(self.expected_data_no_group, list(data))
1191
-
1192
1158
  def test_list_with_protocol(self):
1193
1159
  self._security_group_rule_tcp.port_range_min = 80
1194
1160
  arglist = [
@@ -1265,7 +1231,7 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
1265
1231
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1266
1232
 
1267
1233
  columns, data = self.cmd.take_action(parsed_args)
1268
- filters = {'tenant_id': project.id, 'project_id': project.id}
1234
+ filters = {'project_id': project.id}
1269
1235
 
1270
1236
  self.network_client.security_group_rules.assert_called_once_with(
1271
1237
  **filters
@@ -1291,7 +1257,7 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
1291
1257
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1292
1258
 
1293
1259
  columns, data = self.cmd.take_action(parsed_args)
1294
- filters = {'tenant_id': project.id, 'project_id': project.id}
1260
+ filters = {'project_id': project.id}
1295
1261
 
1296
1262
  self.network_client.security_group_rules.assert_called_once_with(
1297
1263
  **filters
@@ -798,7 +798,8 @@ class TestListSubnet(TestSubnet):
798
798
  'Network',
799
799
  'Subnet',
800
800
  )
801
- columns_long = columns + (
801
+ columns_long = (
802
+ *columns,
802
803
  'Project',
803
804
  'DHCP',
804
805
  'Name Servers',
@@ -471,7 +471,8 @@ class TestListSubnetPool(TestSubnetPool):
471
471
  'Name',
472
472
  'Prefixes',
473
473
  )
474
- columns_long = columns + (
474
+ columns_long = (
475
+ *columns,
475
476
  'Default Prefix Length',
476
477
  'Address Scope',
477
478
  'Default Subnet Pool',
@@ -11,9 +11,8 @@
11
11
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
12
  # License for the specific language governing permissions and limitations
13
13
  # under the License.
14
- #
15
14
 
16
- from keystoneauth1 import session
15
+ from unittest import mock
17
16
 
18
17
  from openstackclient.api import object_store_v1 as object_store
19
18
  from openstackclient.tests.unit import utils
@@ -80,12 +79,14 @@ OBJECT_2 = {
80
79
  object_upload_name = 'test-object-name'
81
80
 
82
81
 
83
- class TestObjectv1(utils.TestCommand):
82
+ class FakeClientMixin:
84
83
  def setUp(self):
85
84
  super().setUp()
86
85
 
87
- self.app.client_manager.session = session.Session()
88
- self.app.client_manager.object_store = object_store.APIv1(
89
- session=self.app.client_manager.session,
90
- endpoint=ENDPOINT,
86
+ self.app.client_manager.object_store = mock.Mock(
87
+ spec=object_store.APIv1
91
88
  )
89
+ self.object_store_client = self.app.client_manager.object_store
90
+
91
+
92
+ class TestObjectV1(FakeClientMixin, utils.TestCommand): ...
@@ -14,48 +14,21 @@
14
14
  #
15
15
 
16
16
  import copy
17
- from unittest import mock
18
17
 
19
- from openstackclient.api import object_store_v1 as object_store
20
18
  from openstackclient.object.v1 import container
21
19
  from openstackclient.tests.unit.object.v1 import fakes as object_fakes
22
20
 
23
21
 
24
- AUTH_TOKEN = "foobar"
25
- AUTH_URL = "http://0.0.0.0"
26
-
27
-
28
- class FakeClient:
29
- def __init__(self, endpoint=None, **kwargs):
30
- self.endpoint = AUTH_URL
31
- self.token = AUTH_TOKEN
32
-
33
-
34
- class TestContainer(object_fakes.TestObjectv1):
35
- columns = ('Name',)
36
-
22
+ class TestContainerDelete(object_fakes.TestObjectV1):
37
23
  def setUp(self):
38
24
  super().setUp()
39
- self.app.client_manager.object_store = object_store.APIv1(
40
- session=mock.Mock(),
41
- service_type="object-store",
42
- )
43
- self.api = self.app.client_manager.object_store
44
-
45
25
 
46
- @mock.patch('openstackclient.api.object_store_v1.APIv1.object_delete')
47
- @mock.patch('openstackclient.api.object_store_v1.APIv1.object_list')
48
- @mock.patch('openstackclient.api.object_store_v1.APIv1.container_delete')
49
- class TestContainerDelete(TestContainer):
50
- def setUp(self):
51
- super().setUp()
26
+ self.object_store_client.container_delete.return_value = None
52
27
 
53
28
  # Get the command object to test
54
29
  self.cmd = container.DeleteContainer(self.app, None)
55
30
 
56
- def test_container_delete(self, c_mock, o_list_mock, o_delete_mock):
57
- c_mock.return_value = None
58
-
31
+ def test_container_delete(self):
59
32
  arglist = [
60
33
  object_fakes.container_name,
61
34
  ]
@@ -68,16 +41,17 @@ class TestContainerDelete(TestContainer):
68
41
  self.assertIsNone(self.cmd.take_action(parsed_args))
69
42
 
70
43
  kwargs = {}
71
- c_mock.assert_called_with(
44
+ self.object_store_client.container_delete.assert_called_with(
72
45
  container=object_fakes.container_name, **kwargs
73
46
  )
74
- self.assertFalse(o_list_mock.called)
75
- self.assertFalse(o_delete_mock.called)
47
+ self.object_store_client.object_list.assert_not_called()
48
+ self.object_store_client.object_delete.assert_not_called()
76
49
 
77
- def test_recursive_delete(self, c_mock, o_list_mock, o_delete_mock):
78
- c_mock.return_value = None
79
- o_list_mock.return_value = [object_fakes.OBJECT]
80
- o_delete_mock.return_value = None
50
+ def test_recursive_delete(self):
51
+ self.object_store_client.object_delete.return_value = None
52
+ self.object_store_client.object_list.return_value = [
53
+ object_fakes.OBJECT
54
+ ]
81
55
 
82
56
  arglist = [
83
57
  '--recursive',
@@ -91,20 +65,22 @@ class TestContainerDelete(TestContainer):
91
65
 
92
66
  self.assertIsNone(self.cmd.take_action(parsed_args))
93
67
 
94
- kwargs = {}
95
- c_mock.assert_called_with(
96
- container=object_fakes.container_name, **kwargs
68
+ self.object_store_client.container_delete.assert_called_with(
69
+ container=object_fakes.container_name
97
70
  )
98
- o_list_mock.assert_called_with(container=object_fakes.container_name)
99
- o_delete_mock.assert_called_with(
71
+ self.object_store_client.object_list.assert_called_with(
72
+ container=object_fakes.container_name
73
+ )
74
+ self.object_store_client.object_delete.assert_called_with(
100
75
  container=object_fakes.container_name,
101
76
  object=object_fakes.OBJECT['name'],
102
77
  )
103
78
 
104
- def test_r_delete(self, c_mock, o_list_mock, o_delete_mock):
105
- c_mock.return_value = None
106
- o_list_mock.return_value = [object_fakes.OBJECT]
107
- o_delete_mock.return_value = None
79
+ def test_r_delete(self):
80
+ self.object_store_client.object_delete.return_value = None
81
+ self.object_store_client.object_list.return_value = [
82
+ object_fakes.OBJECT
83
+ ]
108
84
 
109
85
  arglist = [
110
86
  '-r',
@@ -118,27 +94,29 @@ class TestContainerDelete(TestContainer):
118
94
 
119
95
  self.assertIsNone(self.cmd.take_action(parsed_args))
120
96
 
121
- kwargs = {}
122
- c_mock.assert_called_with(
123
- container=object_fakes.container_name, **kwargs
97
+ self.object_store_client.container_delete.assert_called_with(
98
+ container=object_fakes.container_name
124
99
  )
125
- o_list_mock.assert_called_with(container=object_fakes.container_name)
126
- o_delete_mock.assert_called_with(
100
+ self.object_store_client.object_list.assert_called_with(
101
+ container=object_fakes.container_name
102
+ )
103
+ self.object_store_client.object_delete.assert_called_with(
127
104
  container=object_fakes.container_name,
128
105
  object=object_fakes.OBJECT['name'],
129
106
  )
130
107
 
131
108
 
132
- @mock.patch('openstackclient.api.object_store_v1.APIv1.container_list')
133
- class TestContainerList(TestContainer):
109
+ class TestContainerList(object_fakes.TestObjectV1):
110
+ columns = ('Name',)
111
+
134
112
  def setUp(self):
135
113
  super().setUp()
136
114
 
137
115
  # Get the command object to test
138
116
  self.cmd = container.ListContainer(self.app, None)
139
117
 
140
- def test_object_list_containers_no_options(self, c_mock):
141
- c_mock.return_value = [
118
+ def test_object_list_containers_no_options(self):
119
+ self.object_store_client.container_list.return_value = [
142
120
  copy.deepcopy(object_fakes.CONTAINER),
143
121
  copy.deepcopy(object_fakes.CONTAINER_3),
144
122
  copy.deepcopy(object_fakes.CONTAINER_2),
@@ -153,9 +131,7 @@ class TestContainerList(TestContainer):
153
131
  # containing the data to be listed.
154
132
  columns, data = self.cmd.take_action(parsed_args)
155
133
 
156
- # Set expected values
157
- kwargs = {}
158
- c_mock.assert_called_with(**kwargs)
134
+ self.object_store_client.container_list.assert_called_with()
159
135
 
160
136
  self.assertEqual(self.columns, columns)
161
137
  datalist = (
@@ -165,8 +141,8 @@ class TestContainerList(TestContainer):
165
141
  )
166
142
  self.assertEqual(datalist, tuple(data))
167
143
 
168
- def test_object_list_containers_prefix(self, c_mock):
169
- c_mock.return_value = [
144
+ def test_object_list_containers_prefix(self):
145
+ self.object_store_client.container_list.return_value = [
170
146
  copy.deepcopy(object_fakes.CONTAINER),
171
147
  copy.deepcopy(object_fakes.CONTAINER_3),
172
148
  ]
@@ -185,11 +161,9 @@ class TestContainerList(TestContainer):
185
161
  # containing the data to be listed.
186
162
  columns, data = self.cmd.take_action(parsed_args)
187
163
 
188
- # Set expected values
189
- kwargs = {
190
- 'prefix': 'bit',
191
- }
192
- c_mock.assert_called_with(**kwargs)
164
+ self.object_store_client.container_list.assert_called_with(
165
+ prefix='bit',
166
+ )
193
167
 
194
168
  self.assertEqual(self.columns, columns)
195
169
  datalist = (
@@ -198,8 +172,8 @@ class TestContainerList(TestContainer):
198
172
  )
199
173
  self.assertEqual(datalist, tuple(data))
200
174
 
201
- def test_object_list_containers_marker(self, c_mock):
202
- c_mock.return_value = [
175
+ def test_object_list_containers_marker(self):
176
+ self.object_store_client.container_list.return_value = [
203
177
  copy.deepcopy(object_fakes.CONTAINER),
204
178
  copy.deepcopy(object_fakes.CONTAINER_3),
205
179
  ]
@@ -221,12 +195,10 @@ class TestContainerList(TestContainer):
221
195
  # containing the data to be listed.
222
196
  columns, data = self.cmd.take_action(parsed_args)
223
197
 
224
- # Set expected values
225
- kwargs = {
226
- 'marker': object_fakes.container_name,
227
- 'end_marker': object_fakes.container_name_3,
228
- }
229
- c_mock.assert_called_with(**kwargs)
198
+ self.object_store_client.container_list.assert_called_with(
199
+ marker=object_fakes.container_name,
200
+ end_marker=object_fakes.container_name_3,
201
+ )
230
202
 
231
203
  self.assertEqual(self.columns, columns)
232
204
  datalist = (
@@ -235,8 +207,8 @@ class TestContainerList(TestContainer):
235
207
  )
236
208
  self.assertEqual(datalist, tuple(data))
237
209
 
238
- def test_object_list_containers_limit(self, c_mock):
239
- c_mock.return_value = [
210
+ def test_object_list_containers_limit(self):
211
+ self.object_store_client.container_list.return_value = [
240
212
  copy.deepcopy(object_fakes.CONTAINER),
241
213
  copy.deepcopy(object_fakes.CONTAINER_3),
242
214
  ]
@@ -255,11 +227,9 @@ class TestContainerList(TestContainer):
255
227
  # containing the data to be listed.
256
228
  columns, data = self.cmd.take_action(parsed_args)
257
229
 
258
- # Set expected values
259
- kwargs = {
260
- 'limit': 2,
261
- }
262
- c_mock.assert_called_with(**kwargs)
230
+ self.object_store_client.container_list.assert_called_with(
231
+ limit=2,
232
+ )
263
233
 
264
234
  self.assertEqual(self.columns, columns)
265
235
  datalist = (
@@ -268,8 +238,8 @@ class TestContainerList(TestContainer):
268
238
  )
269
239
  self.assertEqual(datalist, tuple(data))
270
240
 
271
- def test_object_list_containers_long(self, c_mock):
272
- c_mock.return_value = [
241
+ def test_object_list_containers_long(self):
242
+ self.object_store_client.container_list.return_value = [
273
243
  copy.deepcopy(object_fakes.CONTAINER),
274
244
  copy.deepcopy(object_fakes.CONTAINER_3),
275
245
  ]
@@ -287,9 +257,7 @@ class TestContainerList(TestContainer):
287
257
  # containing the data to be listed.
288
258
  columns, data = self.cmd.take_action(parsed_args)
289
259
 
290
- # Set expected values
291
- kwargs = {}
292
- c_mock.assert_called_with(**kwargs)
260
+ self.object_store_client.container_list.assert_called_with()
293
261
 
294
262
  collist = ('Name', 'Bytes', 'Count')
295
263
  self.assertEqual(collist, columns)
@@ -307,8 +275,8 @@ class TestContainerList(TestContainer):
307
275
  )
308
276
  self.assertEqual(datalist, tuple(data))
309
277
 
310
- def test_object_list_containers_all(self, c_mock):
311
- c_mock.return_value = [
278
+ def test_object_list_containers_all(self):
279
+ self.object_store_client.container_list.return_value = [
312
280
  copy.deepcopy(object_fakes.CONTAINER),
313
281
  copy.deepcopy(object_fakes.CONTAINER_2),
314
282
  copy.deepcopy(object_fakes.CONTAINER_3),
@@ -327,11 +295,9 @@ class TestContainerList(TestContainer):
327
295
  # containing the data to be listed.
328
296
  columns, data = self.cmd.take_action(parsed_args)
329
297
 
330
- # Set expected values
331
- kwargs = {
332
- 'full_listing': True,
333
- }
334
- c_mock.assert_called_with(**kwargs)
298
+ self.object_store_client.container_list.assert_called_with(
299
+ full_listing=True,
300
+ )
335
301
 
336
302
  self.assertEqual(self.columns, columns)
337
303
  datalist = (
@@ -342,16 +308,17 @@ class TestContainerList(TestContainer):
342
308
  self.assertEqual(datalist, tuple(data))
343
309
 
344
310
 
345
- @mock.patch('openstackclient.api.object_store_v1.APIv1.container_show')
346
- class TestContainerShow(TestContainer):
311
+ class TestContainerShow(object_fakes.TestObjectV1):
347
312
  def setUp(self):
348
313
  super().setUp()
349
314
 
350
315
  # Get the command object to test
351
316
  self.cmd = container.ShowContainer(self.app, None)
352
317
 
353
- def test_container_show(self, c_mock):
354
- c_mock.return_value = copy.deepcopy(object_fakes.CONTAINER)
318
+ def test_container_show(self):
319
+ self.object_store_client.container_show.return_value = copy.deepcopy(
320
+ object_fakes.CONTAINER
321
+ )
355
322
 
356
323
  arglist = [
357
324
  object_fakes.container_name,
@@ -366,11 +333,8 @@ class TestContainerShow(TestContainer):
366
333
  # data to be shown.
367
334
  columns, data = self.cmd.take_action(parsed_args)
368
335
 
369
- # Set expected values
370
- kwargs = {}
371
- # lib.container.show_container(api, url, container)
372
- c_mock.assert_called_with(
373
- container=object_fakes.container_name, **kwargs
336
+ self.object_store_client.container_show.assert_called_with(
337
+ container=object_fakes.container_name,
374
338
  )
375
339
 
376
340
  collist = ('bytes', 'count', 'name')
@@ -13,17 +13,24 @@
13
13
 
14
14
  import copy
15
15
 
16
+ from keystoneauth1 import session
16
17
  from requests_mock.contrib import fixture
17
18
 
19
+ from openstackclient.api import object_store_v1 as object_store
18
20
  from openstackclient.object.v1 import container as container_cmds
19
21
  from openstackclient.tests.unit.object.v1 import fakes as object_fakes
20
22
 
21
23
 
22
- class TestContainerAll(object_fakes.TestObjectv1):
24
+ class TestContainerAll(object_fakes.TestObjectV1):
23
25
  def setUp(self):
24
26
  super().setUp()
25
27
 
28
+ # these tests require a "real" client since we mock requests
26
29
  self.requests_mock = self.useFixture(fixture.Fixture())
30
+ self.app.client_manager.object_store = object_store.APIv1(
31
+ session=session.Session(),
32
+ endpoint=object_fakes.ENDPOINT,
33
+ )
27
34
 
28
35
 
29
36
  class TestContainerCreate(TestContainerAll):