@typespec/http-client-python 0.1.0

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 (334) hide show
  1. package/README.md +118 -0
  2. package/dist/emitter/code-model.d.ts +4 -0
  3. package/dist/emitter/code-model.d.ts.map +1 -0
  4. package/dist/emitter/code-model.js +195 -0
  5. package/dist/emitter/code-model.js.map +1 -0
  6. package/dist/emitter/emitter.d.ts +6 -0
  7. package/dist/emitter/emitter.d.ts.map +1 -0
  8. package/dist/emitter/emitter.js +104 -0
  9. package/dist/emitter/emitter.js.map +1 -0
  10. package/dist/emitter/external-process.d.ts +20 -0
  11. package/dist/emitter/external-process.d.ts.map +1 -0
  12. package/dist/emitter/external-process.js +44 -0
  13. package/dist/emitter/external-process.js.map +1 -0
  14. package/dist/emitter/http.d.ts +7 -0
  15. package/dist/emitter/http.d.ts.map +1 -0
  16. package/dist/emitter/http.js +268 -0
  17. package/dist/emitter/http.js.map +1 -0
  18. package/dist/emitter/index.d.ts +3 -0
  19. package/dist/emitter/index.d.ts.map +1 -0
  20. package/dist/emitter/index.js +3 -0
  21. package/dist/emitter/index.js.map +1 -0
  22. package/dist/emitter/lib.d.ts +30 -0
  23. package/dist/emitter/lib.d.ts.map +1 -0
  24. package/dist/emitter/lib.js +33 -0
  25. package/dist/emitter/lib.js.map +1 -0
  26. package/dist/emitter/types.d.ts +36 -0
  27. package/dist/emitter/types.d.ts.map +1 -0
  28. package/dist/emitter/types.js +491 -0
  29. package/dist/emitter/types.js.map +1 -0
  30. package/dist/emitter/utils.d.ts +26 -0
  31. package/dist/emitter/utils.d.ts.map +1 -0
  32. package/dist/emitter/utils.js +155 -0
  33. package/dist/emitter/utils.js.map +1 -0
  34. package/emitter/src/code-model.ts +272 -0
  35. package/emitter/src/emitter.ts +127 -0
  36. package/emitter/src/external-process.ts +52 -0
  37. package/emitter/src/http.ts +382 -0
  38. package/emitter/src/index.ts +2 -0
  39. package/emitter/src/lib.ts +59 -0
  40. package/emitter/src/types.ts +573 -0
  41. package/emitter/src/utils.ts +215 -0
  42. package/emitter/temp/tsconfig.tsbuildinfo +1 -0
  43. package/emitter/test/utils.test.ts +22 -0
  44. package/emitter/tsconfig.build.json +11 -0
  45. package/emitter/tsconfig.json +7 -0
  46. package/emitter/vitest.config.ts +4 -0
  47. package/eng/scripts/Build-Packages.ps1 +86 -0
  48. package/eng/scripts/Check-GitChanges.ps1 +22 -0
  49. package/eng/scripts/Functions.ps1 +26 -0
  50. package/eng/scripts/Generate.ps1 +11 -0
  51. package/eng/scripts/Generation.psm1 +22 -0
  52. package/eng/scripts/Initialize-Repository.ps1 +40 -0
  53. package/eng/scripts/Test-Packages.ps1 +65 -0
  54. package/eng/scripts/ci/format.ts +3 -0
  55. package/eng/scripts/ci/lint.ts +39 -0
  56. package/eng/scripts/ci/mypy.ini +38 -0
  57. package/eng/scripts/ci/pylintrc +59 -0
  58. package/eng/scripts/ci/pyproject.toml +18 -0
  59. package/eng/scripts/ci/pyrightconfig.json +6 -0
  60. package/eng/scripts/ci/regenerate.ts +299 -0
  61. package/eng/scripts/ci/run-ci.ts +88 -0
  62. package/eng/scripts/ci/run_apiview.py +40 -0
  63. package/eng/scripts/ci/run_mypy.py +49 -0
  64. package/eng/scripts/ci/run_pylint.py +50 -0
  65. package/eng/scripts/ci/run_pyright.py +58 -0
  66. package/eng/scripts/ci/util.py +72 -0
  67. package/eng/scripts/ci/utils.ts +48 -0
  68. package/eng/scripts/setup/__pycache__/venvtools.cpython-38.pyc +0 -0
  69. package/eng/scripts/setup/install.py +53 -0
  70. package/eng/scripts/setup/prepare.py +42 -0
  71. package/eng/scripts/setup/run-python3.ts +25 -0
  72. package/eng/scripts/setup/run_tsp.py +42 -0
  73. package/eng/scripts/setup/system-requirements.ts +261 -0
  74. package/eng/scripts/setup/venvtools.py +87 -0
  75. package/generator/LICENSE +21 -0
  76. package/generator/README.md +1 -0
  77. package/generator/dev_requirements.txt +13 -0
  78. package/generator/pygen/__init__.py +107 -0
  79. package/generator/pygen/_version.py +7 -0
  80. package/generator/pygen/black.py +71 -0
  81. package/generator/pygen/codegen/__init__.py +338 -0
  82. package/generator/pygen/codegen/_utils.py +17 -0
  83. package/generator/pygen/codegen/models/__init__.py +204 -0
  84. package/generator/pygen/codegen/models/base.py +186 -0
  85. package/generator/pygen/codegen/models/base_builder.py +118 -0
  86. package/generator/pygen/codegen/models/client.py +433 -0
  87. package/generator/pygen/codegen/models/code_model.py +237 -0
  88. package/generator/pygen/codegen/models/combined_type.py +149 -0
  89. package/generator/pygen/codegen/models/constant_type.py +129 -0
  90. package/generator/pygen/codegen/models/credential_types.py +214 -0
  91. package/generator/pygen/codegen/models/dictionary_type.py +127 -0
  92. package/generator/pygen/codegen/models/enum_type.py +238 -0
  93. package/generator/pygen/codegen/models/imports.py +291 -0
  94. package/generator/pygen/codegen/models/list_type.py +143 -0
  95. package/generator/pygen/codegen/models/lro_operation.py +142 -0
  96. package/generator/pygen/codegen/models/lro_paging_operation.py +32 -0
  97. package/generator/pygen/codegen/models/model_type.py +359 -0
  98. package/generator/pygen/codegen/models/operation.py +530 -0
  99. package/generator/pygen/codegen/models/operation_group.py +184 -0
  100. package/generator/pygen/codegen/models/paging_operation.py +155 -0
  101. package/generator/pygen/codegen/models/parameter.py +412 -0
  102. package/generator/pygen/codegen/models/parameter_list.py +387 -0
  103. package/generator/pygen/codegen/models/primitive_types.py +659 -0
  104. package/generator/pygen/codegen/models/property.py +170 -0
  105. package/generator/pygen/codegen/models/request_builder.py +189 -0
  106. package/generator/pygen/codegen/models/request_builder_parameter.py +115 -0
  107. package/generator/pygen/codegen/models/response.py +348 -0
  108. package/generator/pygen/codegen/models/utils.py +21 -0
  109. package/generator/pygen/codegen/serializers/__init__.py +574 -0
  110. package/generator/pygen/codegen/serializers/base_serializer.py +21 -0
  111. package/generator/pygen/codegen/serializers/builder_serializer.py +1507 -0
  112. package/generator/pygen/codegen/serializers/client_serializer.py +294 -0
  113. package/generator/pygen/codegen/serializers/enum_serializer.py +15 -0
  114. package/generator/pygen/codegen/serializers/general_serializer.py +213 -0
  115. package/generator/pygen/codegen/serializers/import_serializer.py +126 -0
  116. package/generator/pygen/codegen/serializers/metadata_serializer.py +198 -0
  117. package/generator/pygen/codegen/serializers/model_init_serializer.py +33 -0
  118. package/generator/pygen/codegen/serializers/model_serializer.py +317 -0
  119. package/generator/pygen/codegen/serializers/operation_groups_serializer.py +89 -0
  120. package/generator/pygen/codegen/serializers/operations_init_serializer.py +44 -0
  121. package/generator/pygen/codegen/serializers/parameter_serializer.py +221 -0
  122. package/generator/pygen/codegen/serializers/patch_serializer.py +19 -0
  123. package/generator/pygen/codegen/serializers/request_builders_serializer.py +52 -0
  124. package/generator/pygen/codegen/serializers/sample_serializer.py +168 -0
  125. package/generator/pygen/codegen/serializers/test_serializer.py +292 -0
  126. package/generator/pygen/codegen/serializers/types_serializer.py +31 -0
  127. package/generator/pygen/codegen/serializers/utils.py +68 -0
  128. package/generator/pygen/codegen/templates/client.py.jinja2 +37 -0
  129. package/generator/pygen/codegen/templates/client_container.py.jinja2 +12 -0
  130. package/generator/pygen/codegen/templates/config.py.jinja2 +73 -0
  131. package/generator/pygen/codegen/templates/config_container.py.jinja2 +16 -0
  132. package/generator/pygen/codegen/templates/conftest.py.jinja2 +28 -0
  133. package/generator/pygen/codegen/templates/enum.py.jinja2 +13 -0
  134. package/generator/pygen/codegen/templates/enum_container.py.jinja2 +10 -0
  135. package/generator/pygen/codegen/templates/init.py.jinja2 +24 -0
  136. package/generator/pygen/codegen/templates/keywords.jinja2 +19 -0
  137. package/generator/pygen/codegen/templates/lro_operation.py.jinja2 +16 -0
  138. package/generator/pygen/codegen/templates/lro_paging_operation.py.jinja2 +18 -0
  139. package/generator/pygen/codegen/templates/macros.jinja2 +12 -0
  140. package/generator/pygen/codegen/templates/metadata.json.jinja2 +167 -0
  141. package/generator/pygen/codegen/templates/model_base.py.jinja2 +1157 -0
  142. package/generator/pygen/codegen/templates/model_container.py.jinja2 +12 -0
  143. package/generator/pygen/codegen/templates/model_dpg.py.jinja2 +97 -0
  144. package/generator/pygen/codegen/templates/model_init.py.jinja2 +28 -0
  145. package/generator/pygen/codegen/templates/model_msrest.py.jinja2 +92 -0
  146. package/generator/pygen/codegen/templates/operation.py.jinja2 +21 -0
  147. package/generator/pygen/codegen/templates/operation_group.py.jinja2 +75 -0
  148. package/generator/pygen/codegen/templates/operation_groups_container.py.jinja2 +19 -0
  149. package/generator/pygen/codegen/templates/operation_tools.jinja2 +81 -0
  150. package/generator/pygen/codegen/templates/operations_folder_init.py.jinja2 +17 -0
  151. package/generator/pygen/codegen/templates/packaging_templates/CHANGELOG.md.jinja2 +6 -0
  152. package/generator/pygen/codegen/templates/packaging_templates/LICENSE.jinja2 +21 -0
  153. package/generator/pygen/codegen/templates/packaging_templates/MANIFEST.in.jinja2 +8 -0
  154. package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +107 -0
  155. package/generator/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +9 -0
  156. package/generator/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +108 -0
  157. package/generator/pygen/codegen/templates/paging_operation.py.jinja2 +21 -0
  158. package/generator/pygen/codegen/templates/patch.py.jinja2 +19 -0
  159. package/generator/pygen/codegen/templates/pkgutil_init.py.jinja2 +1 -0
  160. package/generator/pygen/codegen/templates/request_builder.py.jinja2 +28 -0
  161. package/generator/pygen/codegen/templates/request_builders.py.jinja2 +10 -0
  162. package/generator/pygen/codegen/templates/rest_init.py.jinja2 +12 -0
  163. package/generator/pygen/codegen/templates/sample.py.jinja2 +44 -0
  164. package/generator/pygen/codegen/templates/serialization.py.jinja2 +2114 -0
  165. package/generator/pygen/codegen/templates/test.py.jinja2 +50 -0
  166. package/generator/pygen/codegen/templates/testpreparer.py.jinja2 +26 -0
  167. package/generator/pygen/codegen/templates/types.py.jinja2 +7 -0
  168. package/generator/pygen/codegen/templates/validation.py.jinja2 +38 -0
  169. package/generator/pygen/codegen/templates/vendor.py.jinja2 +95 -0
  170. package/generator/pygen/codegen/templates/version.py.jinja2 +4 -0
  171. package/generator/pygen/m2r.py +65 -0
  172. package/generator/pygen/postprocess/__init__.py +183 -0
  173. package/generator/pygen/postprocess/get_all.py +19 -0
  174. package/generator/pygen/postprocess/venvtools.py +75 -0
  175. package/generator/pygen/preprocess/__init__.py +515 -0
  176. package/generator/pygen/preprocess/helpers.py +27 -0
  177. package/generator/pygen/preprocess/python_mappings.py +224 -0
  178. package/generator/pygen/utils.py +163 -0
  179. package/generator/pygen.egg-info/PKG-INFO +25 -0
  180. package/generator/pygen.egg-info/SOURCES.txt +66 -0
  181. package/generator/pygen.egg-info/dependency_links.txt +1 -0
  182. package/generator/pygen.egg-info/requires.txt +4 -0
  183. package/generator/pygen.egg-info/top_level.txt +1 -0
  184. package/generator/requirements.txt +12 -0
  185. package/generator/setup.py +55 -0
  186. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_models_common_types_managed_identity_async.py +63 -0
  187. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_models_resource_async.py +284 -0
  188. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +101 -0
  189. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +93 -0
  190. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +31 -0
  191. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +76 -0
  192. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +22 -0
  193. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +39 -0
  194. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +33 -0
  195. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +58 -0
  196. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +41 -0
  197. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +87 -0
  198. package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +30 -0
  199. package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +30 -0
  200. package/generator/test/azure/mock_api_tests/conftest.py +150 -0
  201. package/generator/test/azure/mock_api_tests/test_azure_arm_models_common_types_managed_identity.py +60 -0
  202. package/generator/test/azure/mock_api_tests/test_azure_arm_models_resource.py +254 -0
  203. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +92 -0
  204. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +84 -0
  205. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +28 -0
  206. package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +70 -0
  207. package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +20 -0
  208. package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +32 -0
  209. package/generator/test/azure/mock_api_tests/test_azure_core_model.py +30 -0
  210. package/generator/test/azure/mock_api_tests/test_azure_core_page.py +51 -0
  211. package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +35 -0
  212. package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +85 -0
  213. package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +29 -0
  214. package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +29 -0
  215. package/generator/test/azure/requirements.txt +89 -0
  216. package/generator/test/azure/tox.ini +56 -0
  217. package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +121 -0
  218. package/generator/test/generic_mock_api_tests/asynctests/test_client_naming_async.py +69 -0
  219. package/generator/test/generic_mock_api_tests/asynctests/test_client_structure_async.py +62 -0
  220. package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +133 -0
  221. package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +127 -0
  222. package/generator/test/generic_mock_api_tests/asynctests/test_encode_duration_async.py +63 -0
  223. package/generator/test/generic_mock_api_tests/asynctests/test_encode_numeric_async.py +35 -0
  224. package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +35 -0
  225. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_basic_async.py +24 -0
  226. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +30 -0
  227. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +44 -0
  228. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_spread_async.py +76 -0
  229. package/generator/test/generic_mock_api_tests/asynctests/test_payload_content_negotiation_async.py +37 -0
  230. package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +98 -0
  231. package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +27 -0
  232. package/generator/test/generic_mock_api_tests/asynctests/test_payload_multipart_async.py +153 -0
  233. package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +19 -0
  234. package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +103 -0
  235. package/generator/test/generic_mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +128 -0
  236. package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +331 -0
  237. package/generator/test/generic_mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +24 -0
  238. package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +18 -0
  239. package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +25 -0
  240. package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +18 -0
  241. package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +28 -0
  242. package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +34 -0
  243. package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +38 -0
  244. package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +19 -0
  245. package/generator/test/generic_mock_api_tests/asynctests/test_special_words_async.py +42 -0
  246. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +118 -0
  247. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +98 -0
  248. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +25 -0
  249. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +27 -0
  250. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +32 -0
  251. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +70 -0
  252. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +85 -0
  253. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +34 -0
  254. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +34 -0
  255. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +67 -0
  256. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +32 -0
  257. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +47 -0
  258. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +352 -0
  259. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +110 -0
  260. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +197 -0
  261. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +315 -0
  262. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +60 -0
  263. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +90 -0
  264. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +36 -0
  265. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +21 -0
  266. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +21 -0
  267. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +29 -0
  268. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +18 -0
  269. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +22 -0
  270. package/generator/test/generic_mock_api_tests/conftest.py +113 -0
  271. package/generator/test/generic_mock_api_tests/data/image.jpg +0 -0
  272. package/generator/test/generic_mock_api_tests/data/image.png +0 -0
  273. package/generator/test/generic_mock_api_tests/test_authentication.py +113 -0
  274. package/generator/test/generic_mock_api_tests/test_client_naming.py +57 -0
  275. package/generator/test/generic_mock_api_tests/test_client_structure.py +57 -0
  276. package/generator/test/generic_mock_api_tests/test_encode_bytes.py +128 -0
  277. package/generator/test/generic_mock_api_tests/test_encode_datetime.py +123 -0
  278. package/generator/test/generic_mock_api_tests/test_encode_duration.py +60 -0
  279. package/generator/test/generic_mock_api_tests/test_encode_numeric.py +31 -0
  280. package/generator/test/generic_mock_api_tests/test_headasboolean.py +33 -0
  281. package/generator/test/generic_mock_api_tests/test_parameters_basic.py +22 -0
  282. package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +27 -0
  283. package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +37 -0
  284. package/generator/test/generic_mock_api_tests/test_parameters_spread.py +66 -0
  285. package/generator/test/generic_mock_api_tests/test_payload_content_negotiation.py +33 -0
  286. package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +93 -0
  287. package/generator/test/generic_mock_api_tests/test_payload_media_type.py +25 -0
  288. package/generator/test/generic_mock_api_tests/test_payload_multipart.py +140 -0
  289. package/generator/test/generic_mock_api_tests/test_payload_pageable.py +18 -0
  290. package/generator/test/generic_mock_api_tests/test_payload_xml.py +93 -0
  291. package/generator/test/generic_mock_api_tests/test_resiliency_srv_driven.py +122 -0
  292. package/generator/test/generic_mock_api_tests/test_routes.py +285 -0
  293. package/generator/test/generic_mock_api_tests/test_serialization_encoded_name_json.py +21 -0
  294. package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +17 -0
  295. package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +21 -0
  296. package/generator/test/generic_mock_api_tests/test_server_path_single.py +17 -0
  297. package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +25 -0
  298. package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +30 -0
  299. package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +34 -0
  300. package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +18 -0
  301. package/generator/test/generic_mock_api_tests/test_special_words.py +37 -0
  302. package/generator/test/generic_mock_api_tests/test_typetest_array.py +103 -0
  303. package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +86 -0
  304. package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +23 -0
  305. package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +25 -0
  306. package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +29 -0
  307. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +58 -0
  308. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +79 -0
  309. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +31 -0
  310. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +32 -0
  311. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +60 -0
  312. package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +28 -0
  313. package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +40 -0
  314. package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +313 -0
  315. package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +102 -0
  316. package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +174 -0
  317. package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +286 -0
  318. package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +53 -0
  319. package/generator/test/generic_mock_api_tests/test_typetest_union.py +80 -0
  320. package/generator/test/generic_mock_api_tests/test_versioning_added.py +33 -0
  321. package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +20 -0
  322. package/generator/test/generic_mock_api_tests/test_versioning_removed.py +20 -0
  323. package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +27 -0
  324. package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +17 -0
  325. package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +21 -0
  326. package/generator/test/generic_mock_api_tests/unittests/test_model_base_serialization.py +4067 -0
  327. package/generator/test/generic_mock_api_tests/unittests/test_model_base_xml_serialization.py +1001 -0
  328. package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +24 -0
  329. package/generator/test/unbranded/mock_api_tests/cadl-ranch-config.yaml +27 -0
  330. package/generator/test/unbranded/mock_api_tests/conftest.py +35 -0
  331. package/generator/test/unbranded/mock_api_tests/test_unbranded.py +57 -0
  332. package/generator/test/unbranded/requirements.txt +72 -0
  333. package/generator/test/unbranded/tox.ini +56 -0
  334. package/package.json +93 -0
@@ -0,0 +1,122 @@
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 resiliency.srv.driven1 import ResiliencyServiceDrivenClient as V1Client
8
+ from resiliency.srv.driven2 import ResiliencyServiceDrivenClient as V2Client
9
+
10
+
11
+ def get_v1_client(service_deployment_version: str, api_version: str = "v1") -> V1Client:
12
+ return V1Client(
13
+ endpoint="http://localhost:3000",
14
+ service_deployment_version=service_deployment_version,
15
+ api_version=api_version,
16
+ )
17
+
18
+
19
+ def get_v2_client(service_deployment_version: str, api_version: str = "v2") -> V2Client:
20
+ return V2Client(
21
+ endpoint="http://localhost:3000",
22
+ service_deployment_version=service_deployment_version,
23
+ api_version=api_version,
24
+ )
25
+
26
+
27
+ def test_add_optional_param_from_none():
28
+ # old client to old service with api version v1
29
+ with V1Client(endpoint="http://localhost:3000", service_deployment_version="v1") as client:
30
+ client.from_none()
31
+
32
+ # old client to new service with api version v1
33
+ with V1Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
34
+ client.from_none()
35
+
36
+ # new client to new service with api version v1
37
+ with V2Client(
38
+ endpoint="http://localhost:3000",
39
+ service_deployment_version="v2",
40
+ api_version="v1",
41
+ ) as client:
42
+ client.from_none()
43
+
44
+ # new client to new service with api version v2
45
+ with V2Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
46
+ client.from_none(new_parameter="new")
47
+
48
+
49
+ def test_add_optional_param_from_one_required():
50
+ # old client to old service with api version v1
51
+ with V1Client(endpoint="http://localhost:3000", service_deployment_version="v1") as client:
52
+ client.from_one_required(parameter="required")
53
+
54
+ # old client to new service with api version v1
55
+ with V1Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
56
+ client.from_one_required(parameter="required")
57
+
58
+ # new client to new service with api version v1
59
+ with V2Client(
60
+ endpoint="http://localhost:3000",
61
+ service_deployment_version="v2",
62
+ api_version="v1",
63
+ ) as client:
64
+ client.from_one_required(parameter="required")
65
+
66
+ # new client to new service with api version v2
67
+ with V2Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
68
+ client.from_one_required(parameter="required", new_parameter="new")
69
+
70
+
71
+ def test_add_optional_param_from_one_optional():
72
+ # old client to old service with api version v1
73
+ with V1Client(endpoint="http://localhost:3000", service_deployment_version="v1") as client:
74
+ client.from_one_optional(parameter="optional")
75
+
76
+ # old client to new service with api version v1
77
+ with V1Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
78
+ client.from_one_optional(parameter="optional")
79
+
80
+ # new client to new service with api version v1
81
+ with V2Client(
82
+ endpoint="http://localhost:3000",
83
+ service_deployment_version="v2",
84
+ api_version="v1",
85
+ ) as client:
86
+ client.from_one_optional(parameter="optional")
87
+
88
+ # new client to new service with api version v2
89
+ with V2Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
90
+ client.from_one_optional(parameter="optional", new_parameter="new")
91
+
92
+
93
+ def test_break_the_glass(core_library):
94
+ request = core_library.rest.HttpRequest(method="DELETE", url="/add-operation")
95
+ with V1Client(
96
+ endpoint="http://localhost:3000",
97
+ service_deployment_version="v2",
98
+ api_version="v2",
99
+ ) as client:
100
+ response = client.send_request(request)
101
+ response.raise_for_status()
102
+
103
+
104
+ def test_add_operation():
105
+ with V2Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
106
+ client.add_operation()
107
+
108
+
109
+ @pytest.mark.parametrize(
110
+ "func_name, params",
111
+ [
112
+ ("from_none", {"new_parameter": "new"}),
113
+ ("from_one_optional", {"parameter": "optional", "new_parameter": "new"}),
114
+ ("from_one_required", {"parameter": "required", "new_parameter": "new"}),
115
+ ("add_operation", {}),
116
+ ],
117
+ )
118
+ def test_new_client_with_old_apiversion_call_new_parameter(func_name, params):
119
+ client = get_v2_client(service_deployment_version="v2", api_version="v1")
120
+ with pytest.raises(ValueError) as ex:
121
+ getattr(client, func_name)(**params)
122
+ assert "is not available in API version" in str(ex.value)
@@ -0,0 +1,285 @@
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 routes import RoutesClient
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with RoutesClient() as client:
13
+ yield client
14
+
15
+
16
+ def test_fixed(client: RoutesClient):
17
+ client.fixed()
18
+
19
+
20
+ def test_in_interface_fixed(client: RoutesClient):
21
+ client.in_interface.fixed()
22
+
23
+
24
+ def test_path_parameters_template_only(client: RoutesClient):
25
+ client.path_parameters.template_only(
26
+ param="a",
27
+ )
28
+
29
+
30
+ def test_path_parameters_explicit(client: RoutesClient):
31
+ client.path_parameters.explicit(
32
+ param="a",
33
+ )
34
+
35
+
36
+ def test_path_parameters_annotation_only(client: RoutesClient):
37
+ client.path_parameters.annotation_only(
38
+ param="a",
39
+ )
40
+
41
+
42
+ def test_path_parameters_reserved_expansion_template(client: RoutesClient):
43
+ client.path_parameters.reserved_expansion.template(
44
+ param="foo/bar baz",
45
+ )
46
+
47
+
48
+ def test_path_parameters_reserved_expansion_annotation(client: RoutesClient):
49
+ client.path_parameters.reserved_expansion.annotation(
50
+ param="foo/bar baz",
51
+ )
52
+
53
+
54
+ # def test_path_parameters_simple_expansion_standard_primitive(client: RoutesClient):
55
+ # client.path_parameters.simple_expansion.standard.primitive(
56
+ # param="a",
57
+ # )
58
+
59
+
60
+ # def test_path_parameters_simple_expansion_standard_array(client: RoutesClient):
61
+ # client.path_parameters.simple_expansion.standard.array(
62
+ # param=["a", "b"],
63
+ # )
64
+
65
+
66
+ # def test_path_parameters_simple_expansion_standard_record(client: RoutesClient):
67
+ # client.path_parameters.simple_expansion.standard.record(
68
+ # param={"a": 1, "b": 2},
69
+ # )
70
+
71
+
72
+ # def test_path_parameters_simple_expansion_explode_primitive(client: RoutesClient):
73
+ # client.path_parameters.simple_expansion.explode.primitive(
74
+ # param="a",
75
+ # )
76
+
77
+
78
+ # def test_path_parameters_simple_expansion_explode_array(client: RoutesClient):
79
+ # client.path_parameters.simple_expansion.explode.array(
80
+ # param=["a", "b"],
81
+ # )
82
+
83
+
84
+ # def test_path_parameters_simple_expansion_explode_record(client: RoutesClient):
85
+ # client.path_parameters.simple_expansion.explode.record(
86
+ # param={"a": 1, "b": 2},
87
+ # )
88
+
89
+
90
+ # def test_path_parameters_path_expansion_standard_primitive(client: RoutesClient):
91
+ # client.path_parameters.path_expansion.standard.primitive(
92
+ # param="a",
93
+ # )
94
+
95
+
96
+ # def test_path_parameters_path_expansion_standard_array(client: RoutesClient):
97
+ # client.path_parameters.path_expansion.standard.array(
98
+ # param=["a", "b"],
99
+ # )
100
+
101
+
102
+ # def test_path_parameters_path_expansion_standard_record(client: RoutesClient):
103
+ # client.path_parameters.path_expansion.standard.record(
104
+ # param={"a": 1, "b": 2},
105
+ # )
106
+
107
+
108
+ # def test_path_parameters_path_expansion_explode_primitive(client: RoutesClient):
109
+ # client.path_parameters.path_expansion.explode.primitive(
110
+ # param="a",
111
+ # )
112
+
113
+
114
+ # def test_path_parameters_path_expansion_explode_array(client: RoutesClient):
115
+ # client.path_parameters.path_expansion.explode.array(
116
+ # param=["a", "b"],
117
+ # )
118
+
119
+
120
+ # def test_path_parameters_path_expansion_explode_record(client: RoutesClient):
121
+ # client.path_parameters.path_expansion.explode.record(
122
+ # param={"a": 1, "b": 2},
123
+ # )
124
+
125
+
126
+ # def test_path_parameters_label_expansion_standard_primitive(client: RoutesClient):
127
+ # client.path_parameters.label_expansion.standard.primitive(
128
+ # param="a",
129
+ # )
130
+
131
+
132
+ # def test_path_parameters_label_expansion_standard_array(client: RoutesClient):
133
+ # client.path_parameters.label_expansion.standard.array(
134
+ # param=["a", "b"],
135
+ # )
136
+
137
+
138
+ # def test_path_parameters_label_expansion_standard_record(client: RoutesClient):
139
+ # client.path_parameters.label_expansion.standard.record(
140
+ # param={"a": 1, "b": 2},
141
+ # )
142
+
143
+
144
+ # def test_path_parameters_label_expansion_explode_primitive(client: RoutesClient):
145
+ # client.path_parameters.label_expansion.explode.primitive(
146
+ # param="a",
147
+ # )
148
+
149
+
150
+ # def test_path_parameters_label_expansion_explode_array(client: RoutesClient):
151
+ # client.path_parameters.label_expansion.explode.array(
152
+ # param=["a", "b"],
153
+ # )
154
+
155
+
156
+ # def test_path_parameters_label_expansion_explode_record(client: RoutesClient):
157
+ # client.path_parameters.label_expansion.explode.record(
158
+ # param={"a": 1, "b": 2},
159
+ # )
160
+
161
+
162
+ # def test_path_parameters_matrix_expansion_standard_primitive(client: RoutesClient):
163
+ # client.path_parameters.matrix_expansion.standard.primitive(
164
+ # param="a",
165
+ # )
166
+
167
+
168
+ # def test_path_parameters_matrix_expansion_standard_array(client: RoutesClient):
169
+ # client.path_parameters.matrix_expansion.standard.array(
170
+ # param=["a", "b"],
171
+ # )
172
+
173
+
174
+ # def test_path_parameters_matrix_expansion_standard_record(client: RoutesClient):
175
+ # client.path_parameters.matrix_expansion.standard.record(
176
+ # param={"a": 1, "b": 2},
177
+ # )
178
+
179
+
180
+ # def test_path_parameters_matrix_expansion_explode_primitive(client: RoutesClient):
181
+ # client.path_parameters.matrix_expansion.explode.primitive(
182
+ # param="a",
183
+ # )
184
+
185
+
186
+ # def test_path_parameters_matrix_expansion_explode_array(client: RoutesClient):
187
+ # client.path_parameters.matrix_expansion.explode.array(
188
+ # param=["a", "b"],
189
+ # )
190
+
191
+
192
+ # def test_path_parameters_matrix_expansion_explode_record(client: RoutesClient):
193
+ # client.path_parameters.matrix_expansion.explode.record(
194
+ # param={"a": 1, "b": 2},
195
+ # )
196
+
197
+
198
+ def test_query_parameters_template_only(client: RoutesClient):
199
+ client.query_parameters.template_only(
200
+ param="a",
201
+ )
202
+
203
+
204
+ def test_query_parameters_explicit(client: RoutesClient):
205
+ client.query_parameters.explicit(
206
+ param="a",
207
+ )
208
+
209
+
210
+ def test_query_parameters_annotation_only(client: RoutesClient):
211
+ client.query_parameters.annotation_only(
212
+ param="a",
213
+ )
214
+
215
+
216
+ def test_query_parameters_query_expansion_standard_primitive(client: RoutesClient):
217
+ client.query_parameters.query_expansion.standard.primitive(
218
+ param="a",
219
+ )
220
+
221
+
222
+ # def test_query_parameters_query_expansion_standard_array(client: RoutesClient):
223
+ # client.query_parameters.query_expansion.standard.array(
224
+ # param=["a", "b"],
225
+ # )
226
+
227
+
228
+ # def test_query_parameters_query_expansion_standard_record(client: RoutesClient):
229
+ # client.query_parameters.query_expansion.standard.record(
230
+ # param={"a": 1, "b": 2},
231
+ # )
232
+
233
+
234
+ def test_query_parameters_query_expansion_explode_primitive(client: RoutesClient):
235
+ client.query_parameters.query_expansion.explode.primitive(
236
+ param="a",
237
+ )
238
+
239
+
240
+ # def test_query_parameters_query_expansion_explode_array(client: RoutesClient):
241
+ # client.query_parameters.query_expansion.explode.array(
242
+ # param=["a", "b"],
243
+ # )
244
+
245
+
246
+ # def test_query_parameters_query_expansion_explode_record(client: RoutesClient):
247
+ # client.query_parameters.query_expansion.explode.record(
248
+ # param={"a": 1, "b": 2},
249
+ # )
250
+
251
+
252
+ def test_query_parameters_query_continuation_standard_primitive(client: RoutesClient):
253
+ client.query_parameters.query_continuation.standard.primitive(
254
+ param="a",
255
+ )
256
+
257
+
258
+ # def test_query_parameters_query_continuation_standard_array(client: RoutesClient):
259
+ # client.query_parameters.query_continuation.standard.array(
260
+ # param=["a", "b"],
261
+ # )
262
+
263
+
264
+ # def test_query_parameters_query_continuation_standard_record(client: RoutesClient):
265
+ # client.query_parameters.query_continuation.standard.record(
266
+ # param={"a": 1, "b": 2},
267
+ # )
268
+
269
+
270
+ def test_query_parameters_query_continuation_explode_primitive(client: RoutesClient):
271
+ client.query_parameters.query_continuation.explode.primitive(
272
+ param="a",
273
+ )
274
+
275
+
276
+ # def test_query_parameters_query_continuation_explode_array(client: RoutesClient):
277
+ # client.query_parameters.query_continuation.explode.array(
278
+ # param=["a", "b"],
279
+ # )
280
+
281
+
282
+ # def test_query_parameters_query_continuation_explode_record(client: RoutesClient):
283
+ # client.query_parameters.query_continuation.explode.record(
284
+ # param={"a": 1, "b": 2},
285
+ # )
@@ -0,0 +1,21 @@
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 serialization.encodedname.json import JsonClient, models
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with JsonClient() as client:
13
+ yield client
14
+
15
+
16
+ def test_property_send(client: JsonClient):
17
+ client.property.send(models.JsonEncodedNameModel(default_name=True))
18
+
19
+
20
+ def test_property_get(client: JsonClient):
21
+ assert client.property.get().default_name
@@ -0,0 +1,17 @@
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 server.endpoint.notdefined import NotDefinedClient
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with NotDefinedClient(endpoint="http://localhost:3000") as client:
13
+ yield client
14
+
15
+
16
+ def test_valid(client: NotDefinedClient):
17
+ assert client.valid() is True
@@ -0,0 +1,21 @@
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 server.path.multiple import MultipleClient
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with MultipleClient(endpoint="http://localhost:3000") as client:
13
+ yield client
14
+
15
+
16
+ def test_no_operation_params(client: MultipleClient):
17
+ client.no_operation_params()
18
+
19
+
20
+ def test_with_operation_path_param(client: MultipleClient):
21
+ client.with_operation_path_param(keyword="test")
@@ -0,0 +1,17 @@
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 server.path.single import SingleClient
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with SingleClient(endpoint="http://localhost:3000") as client:
13
+ yield client
14
+
15
+
16
+ def test_my_op(client):
17
+ assert client.my_op() is True
@@ -0,0 +1,25 @@
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 server.versions.notversioned import NotVersionedClient
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with NotVersionedClient(endpoint="http://localhost:3000", api_version="v1.0") as client:
13
+ yield client
14
+
15
+
16
+ def test_without_api_version(client: NotVersionedClient):
17
+ client.without_api_version()
18
+
19
+
20
+ def test_with_query_api_version(client: NotVersionedClient):
21
+ client.with_query_api_version()
22
+
23
+
24
+ def test_with_path_api_version(client: NotVersionedClient):
25
+ client.with_path_api_version()
@@ -0,0 +1,30 @@
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 server.versions.versioned import VersionedClient
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with VersionedClient(endpoint="http://localhost:3000") as client:
13
+ yield client
14
+
15
+
16
+ def test_without_api_version(client: VersionedClient):
17
+ client.without_api_version()
18
+
19
+
20
+ def test_with_query_api_version(client: VersionedClient):
21
+ client.with_query_api_version()
22
+
23
+
24
+ def test_with_path_api_version(client: VersionedClient):
25
+ client.with_path_api_version()
26
+
27
+
28
+ def test_with_query_old_api_version():
29
+ with VersionedClient(endpoint="http://localhost:3000", api_version="2021-01-01-preview") as client:
30
+ client.with_query_old_api_version()
@@ -0,0 +1,34 @@
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
+ import datetime
8
+ from specialheaders.conditionalrequest import ConditionalRequestClient
9
+
10
+
11
+ @pytest.fixture
12
+ def client():
13
+ with ConditionalRequestClient() as client:
14
+ yield client
15
+
16
+
17
+ def test_post_if_match(core_library, client: ConditionalRequestClient):
18
+ client.post_if_match(etag="valid", match_condition=core_library.MatchConditions.IfNotModified)
19
+
20
+
21
+ def test_post_if_none_match(core_library, client: ConditionalRequestClient):
22
+ client.post_if_none_match(etag="invalid", match_condition=core_library.MatchConditions.IfModified)
23
+
24
+
25
+ def test_head_if_modified_since(client: ConditionalRequestClient):
26
+ client.head_if_modified_since(
27
+ if_modified_since=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
28
+ )
29
+
30
+
31
+ def test_post_if_unmodified_since(client: ConditionalRequestClient):
32
+ client.post_if_unmodified_since(
33
+ if_unmodified_since=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
34
+ )
@@ -0,0 +1,18 @@
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 specialheaders.repeatability import RepeatabilityClient
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with RepeatabilityClient() as client:
13
+ yield client
14
+
15
+
16
+ def test_immediate_success(client: RepeatabilityClient):
17
+ cls = lambda x, y, z: z
18
+ assert client.immediate_success(cls=cls)["Repeatability-Result"] == "accepted"
@@ -0,0 +1,37 @@
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 specialwords import SpecialWordsClient, models
8
+
9
+
10
+ @pytest.fixture
11
+ def client():
12
+ with SpecialWordsClient() as client:
13
+ yield client
14
+
15
+
16
+ def test_operations(client: SpecialWordsClient, special_words):
17
+ for sw in special_words:
18
+ suffix = "" if sw == "constructor" else "_method"
19
+ getattr(client.operations, sw + suffix)()
20
+
21
+
22
+ def test_parameter(client: SpecialWordsClient, special_words):
23
+ for sw in special_words:
24
+ suffix = "" if sw == "constructor" else "_parameter"
25
+ getattr(client.parameters, "with_" + sw)(**{sw + suffix: "ok"})
26
+ client.parameters.with_cancellation_token(cancellation_token="ok")
27
+
28
+
29
+ def test_model(client: SpecialWordsClient, special_words):
30
+ for sw in special_words:
31
+ suffix = "" if sw == "constructor" else "Model"
32
+ model = getattr(models, sw.capitalize() + suffix)
33
+ getattr(client.models, "with_" + sw)(model(name="ok"))
34
+
35
+
36
+ def test_model_properties(client: SpecialWordsClient):
37
+ client.model_properties.same_as_model(models.SameAsModel(same_as_model="ok"))