@typespec/http-client-python 0.28.1 → 0.28.3

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 (311) hide show
  1. package/dist/emitter/code-model.d.ts.map +1 -1
  2. package/dist/emitter/code-model.js +6 -6
  3. package/dist/emitter/code-model.js.map +1 -1
  4. package/dist/emitter/emitter.d.ts.map +1 -1
  5. package/dist/emitter/emitter.js +27 -28
  6. package/dist/emitter/emitter.js.map +1 -1
  7. package/dist/emitter/lib.d.ts +4 -1
  8. package/dist/emitter/lib.d.ts.map +1 -1
  9. package/dist/emitter/lib.js.map +1 -1
  10. package/dist/emitter/system-requirements.js +6 -4
  11. package/dist/emitter/system-requirements.js.map +1 -1
  12. package/dist/emitter/types.d.ts +2 -5
  13. package/dist/emitter/types.d.ts.map +1 -1
  14. package/dist/emitter/types.js +55 -58
  15. package/dist/emitter/types.js.map +1 -1
  16. package/dist/emitter/utils.d.ts.map +1 -1
  17. package/dist/emitter/utils.js +16 -17
  18. package/dist/emitter/utils.js.map +1 -1
  19. package/emitter/src/code-model.ts +6 -13
  20. package/emitter/src/emitter.ts +29 -31
  21. package/emitter/src/lib.ts +4 -0
  22. package/emitter/src/system-requirements.ts +4 -4
  23. package/emitter/src/types.ts +67 -57
  24. package/emitter/src/utils.ts +16 -18
  25. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  26. package/eng/scripts/Build-Packages.ps1 +62 -37
  27. package/eng/scripts/Check-GitChanges.ps1 +30 -3
  28. package/eng/scripts/Functions.ps1 +54 -15
  29. package/eng/scripts/Generate.ps1 +42 -8
  30. package/eng/scripts/Generation.psm1 +44 -15
  31. package/eng/scripts/Initialize-Repository.ps1 +29 -11
  32. package/eng/scripts/Test-Packages.ps1 +47 -31
  33. package/eng/scripts/ci/config/eslint-ci.config.mjs +54 -0
  34. package/eng/scripts/ci/dev_requirements.txt +1 -0
  35. package/eng/scripts/ci/format.ts +232 -2
  36. package/eng/scripts/ci/lint.ts +216 -20
  37. package/eng/scripts/ci/regenerate-common.ts +18 -14
  38. package/eng/scripts/ci/regenerate.ts +305 -68
  39. package/eng/scripts/ci/run-tests.ts +402 -0
  40. package/eng/scripts/ci/run_mypy.py +4 -3
  41. package/eng/scripts/ci/run_pylint.py +4 -3
  42. package/eng/scripts/ci/run_pyright.py +4 -3
  43. package/eng/scripts/ci/typecheck.ts +225 -0
  44. package/eng/scripts/ci/util.py +1 -1
  45. package/eng/scripts/ci/utils.ts +5 -5
  46. package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
  47. package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
  48. package/eng/scripts/setup/build.ts +1 -1
  49. package/eng/scripts/setup/build_pygen_wheel.py +1 -0
  50. package/eng/scripts/setup/install.py +1 -0
  51. package/eng/scripts/setup/prepare.py +1 -0
  52. package/eng/scripts/setup/prepare.ts +1 -1
  53. package/eng/scripts/setup/run_tsp.py +3 -3
  54. package/eng/scripts/setup/system-requirements.ts +8 -4
  55. package/eng/scripts/setup/venvtools.py +1 -0
  56. package/generator/build/lib/pygen/codegen/models/operation.py +9 -8
  57. package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +157 -64
  58. package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
  59. package/generator/pygen/codegen/models/operation.py +9 -8
  60. package/generator/pygen/codegen/templates/model_base.py.jinja2 +157 -64
  61. package/package.json +48 -42
  62. package/eng/scripts/ci/run-ci.ts +0 -89
  63. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_commonproperties_async.py +0 -94
  64. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_largeheader_async.py +0 -30
  65. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_nonresource_async.py +0 -36
  66. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +0 -205
  67. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_resource_async.py +0 -478
  68. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +0 -101
  69. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_header_async.py +0 -18
  70. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_path_async.py +0 -18
  71. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_query_async.py +0 -18
  72. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_default_value_async.py +0 -46
  73. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_initialization_async.py +0 -58
  74. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_location_async.py +0 -82
  75. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_deserialize_empty_string_as_null_async.py +0 -20
  76. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +0 -115
  77. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_hierrarchy_building_async.py +0 -53
  78. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_next_link_verb_async.py +0 -28
  79. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_override_async.py +0 -106
  80. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +0 -38
  81. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +0 -76
  82. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +0 -22
  83. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +0 -39
  84. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +0 -33
  85. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +0 -80
  86. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +0 -41
  87. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +0 -87
  88. package/generator/test/azure/mock_api_tests/asynctests/test_azure_encode_duration_async.py +0 -19
  89. package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +0 -30
  90. package/generator/test/azure/mock_api_tests/asynctests/test_azure_payload_pageable_async.py +0 -19
  91. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_method_subscription_id_async.py +0 -248
  92. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_async.py +0 -110
  93. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py +0 -132
  94. package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +0 -30
  95. package/generator/test/azure/mock_api_tests/asynctests/test_azure_versioning_previewversion_async.py +0 -53
  96. package/generator/test/azure/mock_api_tests/asynctests/test_client_namespace_async.py +0 -34
  97. package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_async.py +0 -69
  98. package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_enum_conflict_async.py +0 -37
  99. package/generator/test/azure/mock_api_tests/asynctests/test_client_overload_async.py +0 -27
  100. package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_async.py +0 -64
  101. package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_clientoperationgroup_async.py +0 -31
  102. package/generator/test/azure/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
  103. package/generator/test/azure/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
  104. package/generator/test/azure/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
  105. package/generator/test/azure/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
  106. package/generator/test/azure/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
  107. package/generator/test/azure/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -216
  108. package/generator/test/azure/mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +0 -130
  109. package/generator/test/azure/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
  110. package/generator/test/azure/mock_api_tests/asynctests/test_service_multi_service_async.py +0 -31
  111. package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +0 -71
  112. package/generator/test/azure/mock_api_tests/conftest.py +0 -207
  113. package/generator/test/azure/mock_api_tests/data/image.jpg +0 -0
  114. package/generator/test/azure/mock_api_tests/data/image.png +0 -0
  115. package/generator/test/azure/mock_api_tests/test_azure_arm_commonproperties.py +0 -89
  116. package/generator/test/azure/mock_api_tests/test_azure_arm_largeheader.py +0 -27
  117. package/generator/test/azure/mock_api_tests/test_azure_arm_nonresource.py +0 -34
  118. package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +0 -180
  119. package/generator/test/azure/mock_api_tests/test_azure_arm_resource.py +0 -436
  120. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +0 -92
  121. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_header.py +0 -17
  122. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_path.py +0 -17
  123. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_query.py +0 -17
  124. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_default_value.py +0 -42
  125. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_initialization.py +0 -51
  126. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_location.py +0 -70
  127. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_deserialize_empty_string_as_null.py +0 -19
  128. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +0 -104
  129. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_hierrarchy_building.py +0 -45
  130. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_next_link_verb.py +0 -27
  131. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_override.py +0 -102
  132. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +0 -32
  133. package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +0 -70
  134. package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +0 -20
  135. package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +0 -32
  136. package/generator/test/azure/mock_api_tests/test_azure_core_model.py +0 -30
  137. package/generator/test/azure/mock_api_tests/test_azure_core_page.py +0 -71
  138. package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +0 -35
  139. package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +0 -85
  140. package/generator/test/azure/mock_api_tests/test_azure_encode_duration.py +0 -18
  141. package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +0 -29
  142. package/generator/test/azure/mock_api_tests/test_azure_payload_pageable.py +0 -18
  143. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_method_subscription_id.py +0 -235
  144. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service.py +0 -104
  145. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service_shared_models.py +0 -128
  146. package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +0 -29
  147. package/generator/test/azure/mock_api_tests/test_azure_versioning_previewversion.py +0 -50
  148. package/generator/test/azure/mock_api_tests/test_clear_output_folder.py +0 -23
  149. package/generator/test/azure/mock_api_tests/test_client_namespace.py +0 -32
  150. package/generator/test/azure/mock_api_tests/test_client_naming.py +0 -57
  151. package/generator/test/azure/mock_api_tests/test_client_naming_enum_conflict.py +0 -35
  152. package/generator/test/azure/mock_api_tests/test_client_overload.py +0 -25
  153. package/generator/test/azure/mock_api_tests/test_client_structure.py +0 -60
  154. package/generator/test/azure/mock_api_tests/test_client_structure_clientoperationgroup.py +0 -29
  155. package/generator/test/azure/mock_api_tests/test_encode_duration.py +0 -60
  156. package/generator/test/azure/mock_api_tests/test_encode_numeric.py +0 -31
  157. package/generator/test/azure/mock_api_tests/test_model_base_flatten_compatibility.py +0 -251
  158. package/generator/test/azure/mock_api_tests/test_parameters_basic.py +0 -22
  159. package/generator/test/azure/mock_api_tests/test_parameters_spread.py +0 -66
  160. package/generator/test/azure/mock_api_tests/test_payload_content_negotiation.py +0 -33
  161. package/generator/test/azure/mock_api_tests/test_payload_multipart.py +0 -198
  162. package/generator/test/azure/mock_api_tests/test_resiliency_srv_driven.py +0 -124
  163. package/generator/test/azure/mock_api_tests/test_serialization_encoded_name_json.py +0 -21
  164. package/generator/test/azure/mock_api_tests/test_service_multi_service.py +0 -29
  165. package/generator/test/azure/mock_api_tests/test_special_words.py +0 -63
  166. package/generator/test/azure/requirements.txt +0 -125
  167. package/generator/test/azure/tox.ini +0 -64
  168. package/generator/test/data/image.jpg +0 -0
  169. package/generator/test/data/image.png +0 -0
  170. package/generator/test/dev_requirements.txt +0 -8
  171. package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +0 -140
  172. package/generator/test/generic_mock_api_tests/asynctests/test_encode_array_async.py +0 -139
  173. package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +0 -132
  174. package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +0 -127
  175. package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +0 -35
  176. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +0 -30
  177. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +0 -38
  178. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_path_async.py +0 -24
  179. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_query_async.py +0 -18
  180. package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +0 -98
  181. package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +0 -27
  182. package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +0 -134
  183. package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +0 -150
  184. package/generator/test/generic_mock_api_tests/asynctests/test_response_status_code_range_async.py +0 -38
  185. package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +0 -331
  186. package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +0 -18
  187. package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +0 -25
  188. package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +0 -18
  189. package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +0 -28
  190. package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +0 -34
  191. package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +0 -38
  192. package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +0 -19
  193. package/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py +0 -59
  194. package/generator/test/generic_mock_api_tests/asynctests/test_streaming_jsonl_async.py +0 -27
  195. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +0 -127
  196. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +0 -98
  197. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +0 -25
  198. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +0 -27
  199. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_file_async.py +0 -59
  200. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +0 -32
  201. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +0 -70
  202. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +0 -85
  203. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +0 -34
  204. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +0 -34
  205. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +0 -67
  206. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +0 -32
  207. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +0 -47
  208. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +0 -353
  209. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +0 -110
  210. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +0 -197
  211. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +0 -315
  212. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +0 -60
  213. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +0 -90
  214. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +0 -36
  215. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +0 -21
  216. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +0 -39
  217. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +0 -29
  218. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +0 -18
  219. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +0 -22
  220. package/generator/test/generic_mock_api_tests/conftest.py +0 -75
  221. package/generator/test/generic_mock_api_tests/data/image.jpg +0 -0
  222. package/generator/test/generic_mock_api_tests/data/image.png +0 -0
  223. package/generator/test/generic_mock_api_tests/test_authentication.py +0 -130
  224. package/generator/test/generic_mock_api_tests/test_encode_array.py +0 -126
  225. package/generator/test/generic_mock_api_tests/test_encode_bytes.py +0 -128
  226. package/generator/test/generic_mock_api_tests/test_encode_datetime.py +0 -123
  227. package/generator/test/generic_mock_api_tests/test_headasboolean.py +0 -33
  228. package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +0 -27
  229. package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +0 -33
  230. package/generator/test/generic_mock_api_tests/test_parameters_path.py +0 -22
  231. package/generator/test/generic_mock_api_tests/test_parameters_query.py +0 -17
  232. package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +0 -93
  233. package/generator/test/generic_mock_api_tests/test_payload_media_type.py +0 -25
  234. package/generator/test/generic_mock_api_tests/test_payload_pageable.py +0 -99
  235. package/generator/test/generic_mock_api_tests/test_payload_xml.py +0 -135
  236. package/generator/test/generic_mock_api_tests/test_response_status_code_range.py +0 -36
  237. package/generator/test/generic_mock_api_tests/test_routes.py +0 -285
  238. package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +0 -17
  239. package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +0 -21
  240. package/generator/test/generic_mock_api_tests/test_server_path_single.py +0 -17
  241. package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +0 -25
  242. package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +0 -30
  243. package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +0 -34
  244. package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +0 -18
  245. package/generator/test/generic_mock_api_tests/test_specs_documentation.py +0 -51
  246. package/generator/test/generic_mock_api_tests/test_streaming_jsonl.py +0 -25
  247. package/generator/test/generic_mock_api_tests/test_typetest_array.py +0 -111
  248. package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +0 -86
  249. package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +0 -23
  250. package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +0 -25
  251. package/generator/test/generic_mock_api_tests/test_typetest_file.py +0 -52
  252. package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +0 -29
  253. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +0 -58
  254. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +0 -79
  255. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +0 -31
  256. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +0 -32
  257. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +0 -60
  258. package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +0 -28
  259. package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +0 -40
  260. package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +0 -314
  261. package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +0 -102
  262. package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +0 -174
  263. package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +0 -286
  264. package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +0 -53
  265. package/generator/test/generic_mock_api_tests/test_typetest_union.py +0 -80
  266. package/generator/test/generic_mock_api_tests/test_typetest_union_discriminated.py +0 -290
  267. package/generator/test/generic_mock_api_tests/test_versioning_added.py +0 -33
  268. package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +0 -20
  269. package/generator/test/generic_mock_api_tests/test_versioning_removed.py +0 -37
  270. package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +0 -27
  271. package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +0 -17
  272. package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +0 -21
  273. package/generator/test/unbranded/mock_api_tests/asynctests/test_auth_flow_async.py +0 -19
  274. package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
  275. package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
  276. package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
  277. package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
  278. package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
  279. package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -218
  280. package/generator/test/unbranded/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
  281. package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +0 -73
  282. package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +0 -24
  283. package/generator/test/unbranded/mock_api_tests/conftest.py +0 -91
  284. package/generator/test/unbranded/mock_api_tests/data/image.jpg +0 -0
  285. package/generator/test/unbranded/mock_api_tests/data/image.png +0 -0
  286. package/generator/test/unbranded/mock_api_tests/test_auth_flow.py +0 -17
  287. package/generator/test/unbranded/mock_api_tests/test_encode_duration.py +0 -60
  288. package/generator/test/unbranded/mock_api_tests/test_encode_numeric.py +0 -32
  289. package/generator/test/unbranded/mock_api_tests/test_parameters_basic.py +0 -22
  290. package/generator/test/unbranded/mock_api_tests/test_parameters_spread.py +0 -66
  291. package/generator/test/unbranded/mock_api_tests/test_payload_content_negotiation.py +0 -33
  292. package/generator/test/unbranded/mock_api_tests/test_payload_multipart.py +0 -200
  293. package/generator/test/unbranded/mock_api_tests/test_serialization_encoded_name_json.py +0 -22
  294. package/generator/test/unbranded/mock_api_tests/test_special_words.py +0 -66
  295. package/generator/test/unbranded/mock_api_tests/test_unbranded.py +0 -65
  296. package/generator/test/unbranded/requirements.txt +0 -69
  297. package/generator/test/unbranded/tox.ini +0 -64
  298. package/generator/test/unittests/conftest.py +0 -15
  299. package/generator/test/unittests/requirements.txt +0 -3
  300. package/generator/test/unittests/test_enums.py +0 -89
  301. package/generator/test/unittests/test_model_base_serialization.py +0 -4906
  302. package/generator/test/unittests/test_model_base_xml_serialization.py +0 -1239
  303. package/generator/test/unittests/test_name_converter.py +0 -35
  304. package/generator/test/unittests/test_optional_return_type.py +0 -268
  305. package/generator/test/unittests/test_parameter_ordering.py +0 -104
  306. package/generator/test/unittests/test_sort_schema.py +0 -93
  307. package/generator/test/unittests/tox.ini +0 -5
  308. /package/eng/scripts/ci/{mypy.ini → config/mypy.ini} +0 -0
  309. /package/eng/scripts/ci/{pylintrc → config/pylintrc} +0 -0
  310. /package/eng/scripts/ci/{pyproject.toml → config/pyproject.toml} +0 -0
  311. /package/eng/scripts/ci/{pyrightconfig.json → config/pyrightconfig.json} +0 -0
@@ -1,123 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import datetime
7
-
8
- import pytest
9
- from encode.datetime import DatetimeClient
10
- from encode.datetime.models import (
11
- DefaultDatetimeProperty,
12
- Rfc3339DatetimeProperty,
13
- Rfc7231DatetimeProperty,
14
- UnixTimestampDatetimeProperty,
15
- UnixTimestampArrayDatetimeProperty,
16
- )
17
-
18
-
19
- @pytest.fixture
20
- def client():
21
- with DatetimeClient() as client:
22
- yield client
23
-
24
-
25
- def test_query(client: DatetimeClient):
26
- client.query.default(
27
- value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
28
- )
29
- client.query.rfc3339(
30
- value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
31
- )
32
- client.query.rfc7231(
33
- value=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
34
- )
35
- client.query.unix_timestamp(
36
- value=datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
37
- )
38
- client.query.unix_timestamp_array(
39
- value=[
40
- datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
41
- datetime.datetime(2023, 6, 14, 9, 17, 36, tzinfo=datetime.timezone.utc),
42
- ],
43
- )
44
-
45
-
46
- def test_property(client: DatetimeClient):
47
- result = client.property.default(
48
- DefaultDatetimeProperty(
49
- value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
50
- )
51
- )
52
- assert result.value == datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc)
53
-
54
- result = client.property.rfc3339(
55
- Rfc3339DatetimeProperty(
56
- value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
57
- )
58
- )
59
- assert result.value == datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc)
60
-
61
- result = client.property.rfc7231(
62
- Rfc7231DatetimeProperty(
63
- value=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
64
- )
65
- )
66
- assert result.value == datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
67
-
68
- result = client.property.unix_timestamp(
69
- UnixTimestampDatetimeProperty(
70
- value=datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
71
- )
72
- )
73
- assert result.value == datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc)
74
-
75
- result = client.property.unix_timestamp_array(
76
- UnixTimestampArrayDatetimeProperty(
77
- value=[
78
- datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
79
- datetime.datetime(2023, 6, 14, 9, 17, 36, tzinfo=datetime.timezone.utc),
80
- ],
81
- )
82
- )
83
- assert result.value == [
84
- datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
85
- datetime.datetime(2023, 6, 14, 9, 17, 36, tzinfo=datetime.timezone.utc),
86
- ]
87
-
88
-
89
- def test_header(client: DatetimeClient):
90
- client.header.default(
91
- value=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
92
- )
93
- client.header.rfc3339(
94
- value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
95
- )
96
- client.header.rfc7231(
97
- value=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
98
- )
99
- client.header.unix_timestamp(
100
- value=datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
101
- )
102
- client.header.unix_timestamp_array(
103
- value=[
104
- datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
105
- datetime.datetime(2023, 6, 14, 9, 17, 36, tzinfo=datetime.timezone.utc),
106
- ]
107
- )
108
-
109
-
110
- def test_response_header(client: DatetimeClient):
111
- cls = lambda x, y, z: z
112
- assert client.response_header.default(cls=cls)["value"] == datetime.datetime(
113
- 2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc
114
- )
115
- assert client.response_header.rfc3339(cls=cls)["value"] == datetime.datetime(
116
- 2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc
117
- )
118
- assert client.response_header.rfc7231(cls=cls)["value"] == datetime.datetime(
119
- 2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc
120
- )
121
- assert client.response_header.unix_timestamp(cls=cls)["value"] == datetime.datetime(
122
- 2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc
123
- )
@@ -1,33 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from headasbooleantrue import VisibilityClient as HeadAsBooleanTrueClient
8
- from headasbooleantrue import models as models_true
9
-
10
- from headasbooleanfalse import VisibilityClient as HeadAsBooleanFalseClient
11
- from headasbooleanfalse import models as models_false
12
-
13
-
14
- @pytest.fixture
15
- def client_true():
16
- with HeadAsBooleanTrueClient() as client:
17
- yield client
18
-
19
-
20
- @pytest.fixture
21
- def client_false():
22
- with HeadAsBooleanFalseClient() as client:
23
- yield client
24
-
25
-
26
- def test_head_true(client_true):
27
- body = models_true.VisibilityModel()
28
- assert client_true.head_model(body, query_prop=123) == True
29
-
30
-
31
- def test_head_false(client_false):
32
- body = models_false.VisibilityModel()
33
- assert client_false.head_model(body, query_prop=123) is None
@@ -1,27 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from parameters.bodyoptionality import BodyOptionalityClient
8
- from parameters.bodyoptionality.models import BodyModel
9
-
10
-
11
- @pytest.fixture
12
- def client():
13
- with BodyOptionalityClient() as client:
14
- yield client
15
-
16
-
17
- def test_required_explicit(client: BodyOptionalityClient):
18
- client.required_explicit(BodyModel(name="foo"))
19
-
20
-
21
- def test_required_implicit(client: BodyOptionalityClient):
22
- client.required_implicit(name="foo")
23
-
24
-
25
- def test_optional_explicit(client: BodyOptionalityClient):
26
- client.optional_explicit.set(BodyModel(name="foo"))
27
- client.optional_explicit.omit()
@@ -1,33 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from parameters.collectionformat import CollectionFormatClient
8
-
9
-
10
- @pytest.fixture
11
- def client():
12
- with CollectionFormatClient() as client:
13
- yield client
14
-
15
-
16
- def test_query_multi(client: CollectionFormatClient):
17
- client.query.multi(colors=["blue", "red", "green"])
18
-
19
-
20
- def test_query_csv(client: CollectionFormatClient):
21
- client.query.csv(colors=["blue", "red", "green"])
22
-
23
-
24
- def test_query_pipes(client: CollectionFormatClient):
25
- client.query.pipes(colors=["blue", "red", "green"])
26
-
27
-
28
- def test_query_ssv(client: CollectionFormatClient):
29
- client.query.ssv(colors=["blue", "red", "green"])
30
-
31
-
32
- def test_csv_header(client: CollectionFormatClient):
33
- client.header.csv(colors=["blue", "red", "green"])
@@ -1,22 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from parameters.path import PathClient
8
-
9
-
10
- @pytest.fixture
11
- def client():
12
- with PathClient() as client:
13
- yield client
14
-
15
-
16
- def test_normal(client: PathClient):
17
- client.normal("foo")
18
-
19
-
20
- def test_optional(client: PathClient):
21
- client.optional()
22
- client.optional(name="foo")
@@ -1,17 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from parameters.query import QueryClient
8
-
9
-
10
- @pytest.fixture
11
- def client():
12
- with QueryClient() as client:
13
- yield client
14
-
15
-
16
- def test_constant(client: QueryClient):
17
- client.constant.post()
@@ -1,93 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from payload.jsonmergepatch import JsonMergePatchClient
8
- from payload.jsonmergepatch.models import InnerModel, Resource, ResourcePatch
9
-
10
- try:
11
- from azure.core.serialization import NULL
12
- except ImportError:
13
- from corehttp.serialization import NULL
14
-
15
-
16
- @pytest.fixture
17
- def client():
18
- with JsonMergePatchClient(endpoint="http://localhost:3000") as client:
19
- yield client
20
-
21
-
22
- def test_create_resource(client: JsonMergePatchClient):
23
- inner_madge = InnerModel(name="InnerMadge", description="innerDesc")
24
- create_resource = Resource(
25
- name="Madge",
26
- description="desc",
27
- map={"key": inner_madge},
28
- array=[inner_madge],
29
- int_value=1,
30
- float_value=1.25,
31
- inner_model=inner_madge,
32
- int_array=[1, 2, 3],
33
- )
34
- response = client.create_resource(create_resource)
35
- assert response == create_resource
36
-
37
-
38
- def test_update_resource_model_input(client: JsonMergePatchClient):
39
- update_resource = ResourcePatch(
40
- description=NULL,
41
- map={"key": InnerModel(description=NULL), "key2": NULL},
42
- array=NULL,
43
- int_value=NULL,
44
- float_value=NULL,
45
- inner_model=NULL,
46
- int_array=NULL,
47
- )
48
- response = client.update_resource(update_resource)
49
- assert response == Resource(name="Madge", map={"key": InnerModel(name="InnerMadge")})
50
-
51
-
52
- def test_update_resource_raw_input(client: JsonMergePatchClient):
53
- response = client.update_resource(
54
- {
55
- "description": None,
56
- "map": {"key": {"description": None}, "key2": None},
57
- "array": None,
58
- "intValue": None,
59
- "floatValue": None,
60
- "innerModel": None,
61
- "intArray": None,
62
- }
63
- )
64
- assert response == Resource(name="Madge", map={"key": InnerModel(name="InnerMadge")})
65
-
66
-
67
- def test_update_optional_resource_model_input(client: JsonMergePatchClient):
68
- update_resource = ResourcePatch(
69
- description=NULL,
70
- map={"key": InnerModel(description=NULL), "key2": NULL},
71
- array=NULL,
72
- int_value=NULL,
73
- float_value=NULL,
74
- inner_model=NULL,
75
- int_array=NULL,
76
- )
77
- response = client.update_optional_resource(update_resource)
78
- assert response == Resource(name="Madge", map={"key": InnerModel(name="InnerMadge")})
79
-
80
-
81
- def test_update_optional_resource_raw_input(client: JsonMergePatchClient):
82
- response = client.update_optional_resource(
83
- {
84
- "description": None,
85
- "map": {"key": {"description": None}, "key2": None},
86
- "array": None,
87
- "intValue": None,
88
- "floatValue": None,
89
- "innerModel": None,
90
- "intArray": None,
91
- }
92
- )
93
- assert response == Resource(name="Madge", map={"key": InnerModel(name="InnerMadge")})
@@ -1,25 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from payload.mediatype import MediaTypeClient
8
-
9
-
10
- @pytest.fixture
11
- def client():
12
- with MediaTypeClient(endpoint="http://localhost:3000") as client:
13
- yield client
14
-
15
-
16
- def test_json(client: MediaTypeClient):
17
- data = "foo"
18
- client.string_body.send_as_json(data)
19
- assert client.string_body.get_as_json() == data
20
-
21
-
22
- def test_text(client: MediaTypeClient):
23
- data = "{cat}"
24
- client.string_body.send_as_text(data)
25
- assert client.string_body.get_as_text() == data
@@ -1,99 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from payload.pageable import PageableClient
8
- from payload.pageable.serverdrivenpagination.alternateinitialverb.models import Filter
9
-
10
-
11
- @pytest.fixture
12
- def client():
13
- with PageableClient(endpoint="http://localhost:3000") as client:
14
- yield client
15
-
16
-
17
- def assert_result(result):
18
- assert len(result) == 4
19
- assert result[0].id == "1"
20
- assert result[1].id == "2"
21
- assert result[2].id == "3"
22
- assert result[3].id == "4"
23
- assert result[0].name == "dog"
24
- assert result[1].name == "cat"
25
- assert result[2].name == "bird"
26
- assert result[3].name == "fish"
27
-
28
-
29
- def test_link(client: PageableClient):
30
- result = list(client.server_driven_pagination.link())
31
- assert_result(result)
32
-
33
-
34
- def test_link_string(client: PageableClient):
35
- result = list(client.server_driven_pagination.link_string())
36
- assert_result(result)
37
-
38
-
39
- def test_request_query_response_body(client: PageableClient):
40
- result = list(client.server_driven_pagination.continuation_token.request_query_response_body(foo="foo", bar="bar"))
41
- assert_result(result)
42
-
43
-
44
- def test_request_header_response_body(client: PageableClient):
45
- result = list(client.server_driven_pagination.continuation_token.request_header_response_body(foo="foo", bar="bar"))
46
- assert_result(result)
47
-
48
-
49
- def test_request_query_response_header(client: PageableClient):
50
- result = list(
51
- client.server_driven_pagination.continuation_token.request_query_response_header(foo="foo", bar="bar")
52
- )
53
- assert_result(result)
54
-
55
-
56
- def test_request_header_response_header(client: PageableClient):
57
- result = list(
58
- client.server_driven_pagination.continuation_token.request_header_response_header(foo="foo", bar="bar")
59
- )
60
- assert_result(result)
61
-
62
-
63
- def test_nested_link(client: PageableClient):
64
- result = list(client.server_driven_pagination.nested_link())
65
- assert_result(result)
66
-
67
-
68
- def test_request_query_nested_response_body(client: PageableClient):
69
- result = list(
70
- client.server_driven_pagination.continuation_token.request_query_nested_response_body(foo="foo", bar="bar")
71
- )
72
- assert_result(result)
73
-
74
-
75
- def test_request_header_nested_response_body(client: PageableClient):
76
- result = list(
77
- client.server_driven_pagination.continuation_token.request_header_nested_response_body(foo="foo", bar="bar")
78
- )
79
- assert_result(result)
80
-
81
-
82
- def test_list_without_continuation(client: PageableClient):
83
- result = list(client.page_size.list_without_continuation())
84
- assert_result(result)
85
-
86
-
87
- def test_xml_pagination_list_with_continuation(client: PageableClient):
88
- result = list(client.xml_pagination.list_with_continuation())
89
- assert_result(result)
90
-
91
-
92
- def test_xml_pagination_list_with_next_link(client: PageableClient):
93
- result = list(client.xml_pagination.list_with_next_link())
94
- assert_result(result)
95
-
96
-
97
- def test_alternate_initial_verb_post(client: PageableClient):
98
- result = list(client.server_driven_pagination.alternate_initial_verb.post(Filter(filter="foo eq bar")))
99
- assert_result(result)
@@ -1,135 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import datetime
7
- import pytest
8
- from payload.xml import XmlClient
9
- from payload.xml.models import (
10
- SimpleModel,
11
- ModelWithSimpleArrays,
12
- ModelWithArrayOfModel,
13
- ModelWithAttributes,
14
- ModelWithUnwrappedArray,
15
- ModelWithRenamedArrays,
16
- ModelWithOptionalField,
17
- ModelWithRenamedFields,
18
- ModelWithEmptyArray,
19
- ModelWithText,
20
- ModelWithDictionary,
21
- ModelWithEncodedNames,
22
- ModelWithEnum,
23
- ModelWithDatetime,
24
- )
25
-
26
-
27
- @pytest.fixture
28
- def client():
29
- with XmlClient(endpoint="http://localhost:3000") as client:
30
- yield client
31
-
32
-
33
- def test_simple_model(client: XmlClient):
34
- model = SimpleModel(name="foo", age=123)
35
- assert client.simple_model_value.get() == model
36
- client.simple_model_value.put(model)
37
-
38
-
39
- def test_model_with_simple_arrays(client: XmlClient):
40
- model = ModelWithSimpleArrays(colors=["red", "green", "blue"], counts=[1, 2])
41
- assert client.model_with_simple_arrays_value.get() == model
42
- client.model_with_simple_arrays_value.put(model)
43
-
44
-
45
- def test_model_with_array_of_model(client: XmlClient):
46
- model = ModelWithArrayOfModel(
47
- items_property=[
48
- SimpleModel(name="foo", age=123),
49
- SimpleModel(name="bar", age=456),
50
- ]
51
- )
52
- assert client.model_with_array_of_model_value.get() == model
53
- client.model_with_array_of_model_value.put(model)
54
-
55
-
56
- def test_model_with_attributes(client: XmlClient):
57
- model = ModelWithAttributes(id1=123, id2="foo", enabled=True)
58
- assert client.model_with_attributes_value.get() == model
59
- client.model_with_attributes_value.put(model)
60
-
61
-
62
- def test_model_with_unwrapped_array(client: XmlClient):
63
- model = ModelWithUnwrappedArray(colors=["red", "green", "blue"], counts=[1, 2])
64
- assert client.model_with_unwrapped_array_value.get() == model
65
- client.model_with_unwrapped_array_value.put(model)
66
-
67
-
68
- def test_model_with_renamed_arrays(client: XmlClient):
69
- model = ModelWithRenamedArrays(colors=["red", "green", "blue"], counts=[1, 2])
70
- assert client.model_with_renamed_arrays_value.get() == model
71
- client.model_with_renamed_arrays_value.put(model)
72
-
73
-
74
- def test_model_with_optional_field(client: XmlClient):
75
- model = ModelWithOptionalField(item="widget")
76
- assert client.model_with_optional_field_value.get() == model
77
- client.model_with_optional_field_value.put(model)
78
-
79
-
80
- def test_model_with_renamed_fields(client: XmlClient):
81
- model = ModelWithRenamedFields(
82
- input_data=SimpleModel(name="foo", age=123),
83
- output_data=SimpleModel(name="bar", age=456),
84
- )
85
- assert client.model_with_renamed_fields_value.get() == model
86
- client.model_with_renamed_fields_value.put(model)
87
-
88
-
89
- def test_model_with_empty_array(client: XmlClient):
90
- model = ModelWithEmptyArray(items_property=[])
91
- assert client.model_with_empty_array_value.get() == model
92
- client.model_with_empty_array_value.put(model)
93
-
94
-
95
- def test_model_with_text(client: XmlClient):
96
- model = ModelWithText(language="foo", content="\n This is some text.\n")
97
- assert client.model_with_text_value.get() == model
98
- client.model_with_text_value.put(model)
99
-
100
-
101
- def test_model_with_dictionary(client: XmlClient):
102
- model = ModelWithDictionary(metadata={"Color": "blue", "Count": "123", "Enabled": "false"})
103
- assert client.model_with_dictionary_value.get() == model
104
- client.model_with_dictionary_value.put(model)
105
-
106
-
107
- def test_model_with_encoded_names(client: XmlClient):
108
- model = ModelWithEncodedNames(model_data=SimpleModel(name="foo", age=123), colors=["red", "green", "blue"])
109
- assert client.model_with_encoded_names_value.get() == model
110
- client.model_with_encoded_names_value.put(model)
111
-
112
-
113
- def test_model_with_enum(client: XmlClient):
114
- model = ModelWithEnum(status="success")
115
- assert client.model_with_enum_value.get() == model
116
- client.model_with_enum_value.put(model)
117
-
118
-
119
- def test_model_with_datetime(client: XmlClient):
120
- model = ModelWithDatetime(
121
- rfc3339=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
122
- rfc7231=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
123
- )
124
- result = client.model_with_datetime_value.get()
125
- assert result.rfc3339 == model.rfc3339
126
- assert result.rfc7231 == model.rfc7231
127
- client.model_with_datetime_value.put(model)
128
-
129
-
130
- def test_xml_error_value(client: XmlClient, core_library):
131
- with pytest.raises(core_library.exceptions.HttpResponseError) as ex:
132
- client.xml_error_value.get()
133
- assert ex.value.status_code == 400
134
- assert ex.value.model.message == "Something went wrong"
135
- assert ex.value.model.code == 400
@@ -1,36 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from response.statuscoderange import StatusCodeRangeClient
8
- from response.statuscoderange.models import ErrorInRange, NotFoundError
9
-
10
-
11
- @pytest.fixture
12
- def client():
13
- with StatusCodeRangeClient(endpoint="http://localhost:3000") as client:
14
- yield client
15
-
16
-
17
- def test_error_response_status_code_in_range(client: StatusCodeRangeClient):
18
- with pytest.raises(Exception) as exc_info:
19
- client.error_response_status_code_in_range()
20
-
21
- error = exc_info.value.model
22
- assert isinstance(error, ErrorInRange)
23
- assert error.code == "request-header-too-large"
24
- assert error.message == "Request header too large"
25
- assert exc_info.value.response.status_code == 494
26
-
27
-
28
- def test_error_response_status_code_404(client: StatusCodeRangeClient):
29
- with pytest.raises(Exception) as exc_info:
30
- client.error_response_status_code404()
31
-
32
- error = exc_info.value.model
33
- assert isinstance(error, NotFoundError)
34
- assert error.code == "not-found"
35
- assert error.resource_id == "resource1"
36
- assert exc_info.value.response.status_code == 404