diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_file_service_properties.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_file_service_properties.json new file mode 100644 index 000000000000..c01f1b9acbab --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_file_service_properties.json @@ -0,0 +1,113 @@ +{ + "Entries": [ + { + "RequestUri": "https://pyacrstoragestorname.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "469", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:24:13 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:24:14 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://pyacrstoragestorname.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:24:15 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:24:14 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + }, + { + "RequestUri": "https://pyacrstoragestorname.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "468", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:24:15 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:24:14 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://pyacrstoragestorname.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:24:15 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:24:14 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_retention_no_days.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_retention_no_days.json new file mode 100644 index 000000000000..f721723386d8 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_retention_no_days.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_cors.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_cors.json new file mode 100644 index 000000000000..206141138091 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_cors.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "631", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:20:48 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com,www.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedHeaders\u003Ex-ms-meta-data*,x-ms-meta-target*,x-ms-meta-xyz,x-ms-meta-foo\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-data*,x-ms-meta-source*,x-ms-meta-abc,x-ms-meta-bcd\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:20:46 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:20:48 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:20:46 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.xyz.com,www.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders\u003Ex-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_hour_metrics.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_hour_metrics.json new file mode 100644 index 000000000000..651d73959202 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_hour_metrics.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "267", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:20:46 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:20:45 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:20:47 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:20:45 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_minute_metrics.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_minute_metrics.json new file mode 100644 index 000000000000..b1e83918a821 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_set_minute_metrics.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "271", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:20:47 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:20:46 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:20:47 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:20:46 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_too_many_cors_rules.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_too_many_cors_rules.json new file mode 100644 index 000000000000..8dbd1ff157e6 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.pyTestFileServicePropertiestest_too_many_cors_rules.json @@ -0,0 +1,40 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "1143", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:20:49 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 400, + "ResponseHeaders": { + "Content-Length": "294", + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:20:47 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-error-code": "InvalidXmlDocument", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": [ + "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CError\u003E\u003CCode\u003EInvalidXmlDocument\u003C/Code\u003E\u003CMessage\u003EXML specified is not syntactically valid.\n", + "RequestId:5c928474-b01a-0026-5dc8-ddbe65000000\n", + "Time:2022-10-11T23:20:48.4381416Z\u003C/Message\u003E\u003CLineNumber\u003E0\u003C/LineNumber\u003E\u003CLinePosition\u003E0\u003C/LinePosition\u003E\u003CReason /\u003E\u003C/Error\u003E" + ] + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_file_service_properties.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_file_service_properties.yaml deleted file mode 100644 index e942c7f5ca0b..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_file_service_properties.yaml +++ /dev/null @@ -1,154 +0,0 @@ -interactions: -- request: - body: ' - - 1.0falsefalse1.0falsefalsefalse' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '469' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:45:18 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: - - Fri, 18 Sep 2020 01:45:17 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - x-ms-version: - - '2020-02-10' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:45:19 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0falsefalse1.0falsefalsefalse" - headers: - content-type: - - application/xml - date: - - Fri, 18 Sep 2020 01:45:18 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - vary: - - Origin - x-ms-version: - - '2020-02-10' - status: - code: 200 - message: OK -- request: - body: ' - - 1.0falsefalse1.0falsefalsetrue' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '468' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:45:19 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: - - Fri, 18 Sep 2020 01:45:18 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - x-ms-version: - - '2020-02-10' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:45:19 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0falsefalse1.0falsefalsetrue" - headers: - content-type: - - application/xml - date: - - Fri, 18 Sep 2020 01:45:18 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - vary: - - Origin - x-ms-version: - - '2020-02-10' - status: - code: 200 - message: OK -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_cors.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_cors.yaml deleted file mode 100644 index 91758e790171..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_cors.yaml +++ /dev/null @@ -1,78 +0,0 @@ -interactions: -- request: - body: ' - - www.xyz.comGET0www.xyz.com,www.ab.com,www.bc.comGET,PUTx-ms-meta-data*,x-ms-meta-target*,x-ms-meta-xyz,x-ms-meta-foox-ms-meta-data*,x-ms-meta-source*,x-ms-meta-abc,x-ms-meta-bcd500' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '631' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Thu, 17 Sep 2020 17:19:38 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: - - Thu, 17 Sep 2020 17:19:40 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - x-ms-version: - - '2020-02-10' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Thu, 17 Sep 2020 17:19:41 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0falsefalse1.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true" - headers: - content-type: - - application/xml - date: - - Thu, 17 Sep 2020 17:19:40 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - vary: - - Origin - x-ms-version: - - '2020-02-10' - status: - code: 200 - message: OK -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_hour_metrics.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_hour_metrics.yaml deleted file mode 100644 index 08b9ee6d9948..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_hour_metrics.yaml +++ /dev/null @@ -1,77 +0,0 @@ -interactions: -- request: - body: ' - - 1.0truetruetrue5' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '267' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Thu, 17 Sep 2020 17:19:41 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: - - Thu, 17 Sep 2020 17:19:42 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - x-ms-version: - - '2020-02-10' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Thu, 17 Sep 2020 17:19:44 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0truetruetrue51.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true" - headers: - content-type: - - application/xml - date: - - Thu, 17 Sep 2020 17:19:42 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - vary: - - Origin - x-ms-version: - - '2020-02-10' - status: - code: 200 - message: OK -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_minute_metrics.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_minute_metrics.yaml deleted file mode 100644 index dbf96f07169a..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_set_minute_metrics.yaml +++ /dev/null @@ -1,77 +0,0 @@ -interactions: -- request: - body: ' - - 1.0truetruetrue5' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '271' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Thu, 17 Sep 2020 17:19:44 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: - - Thu, 17 Sep 2020 17:19:44 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - x-ms-version: - - '2020-02-10' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Thu, 17 Sep 2020 17:19:45 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0truetruetrue51.0truetruetrue5GETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true" - headers: - content-type: - - application/xml - date: - - Thu, 17 Sep 2020 17:19:44 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - vary: - - Origin - x-ms-version: - - '2020-02-10' - status: - code: 200 - message: OK -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_too_many_cors_rules.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_too_many_cors_rules.yaml deleted file mode 100644 index cd70dd61c7c6..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties.test_too_many_cors_rules.yaml +++ /dev/null @@ -1,52 +0,0 @@ -interactions: -- request: - body: ' - - www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '1143' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Thu, 17 Sep 2020 17:19:45 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFFInvalidXmlDocumentXML - specified is not syntactically valid.\nRequestId:d03cd37c-001a-0055-3316-8d26c7000000\nTime:2020-09-17T17:19:45.0171279Z00" - headers: - content-length: - - '294' - content-type: - - application/xml - date: - - Thu, 17 Sep 2020 17:19:44 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - x-ms-error-code: - - InvalidXmlDocument - x-ms-version: - - '2020-02-10' - status: - code: 400 - message: XML specified is not syntactically valid. -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_file_service_properties.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_file_service_properties.json new file mode 100644 index 000000000000..ceef1e2bb9ea --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_file_service_properties.json @@ -0,0 +1,109 @@ +{ + "Entries": [ + { + "RequestUri": "https://pyacrstoragestorname.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "469", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:29 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:33:29 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://pyacrstoragestorname.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:30 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:33:29 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + }, + { + "RequestUri": "https://pyacrstoragestorname.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "468", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:30 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:33:29 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://pyacrstoragestorname.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:31 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:33:29 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_cors.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_cors.json new file mode 100644 index 000000000000..e173939a5904 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_cors.json @@ -0,0 +1,58 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "631", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:33 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com,www.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedHeaders\u003Ex-ms-meta-data*,x-ms-meta-target*,x-ms-meta-xyz,x-ms-meta-foo\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-data*,x-ms-meta-source*,x-ms-meta-abc,x-ms-meta-bcd\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:33:32 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:33 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:33:32 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.xyz.com,www.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders\u003Ex-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_hour_metrics.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_hour_metrics.json new file mode 100644 index 000000000000..9d272b4d59d8 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_hour_metrics.json @@ -0,0 +1,58 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "267", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:31 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:33:31 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:32 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:33:31 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.xyz.com,www.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders\u003Ex-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_minute_metrics.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_minute_metrics.json new file mode 100644 index 000000000000..baf7dd3ff4bb --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_set_minute_metrics.json @@ -0,0 +1,58 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "271", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:32 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 202, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 11 Oct 2022 23:33:31 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-06-08" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:32 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:33:31 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.xyz.com,www.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders\u003Ex-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003CProtocolSettings\u003E\u003CSMB\u003E\u003CMultichannel\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/Multichannel\u003E\u003C/SMB\u003E\u003C/ProtocolSettings\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_too_many_cors_rules.json b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_too_many_cors_rules.json new file mode 100644 index 000000000000..810444495e22 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.pyTestFileServicePropertiesAsynctest_too_many_cors_rules.json @@ -0,0 +1,39 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.file.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "1143", + "Content-Type": "application/xml", + "User-Agent": "azsdk-python-storage-file-share/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)", + "x-ms-date": "Tue, 11 Oct 2022 23:33:33 GMT", + "x-ms-version": "2021-06-08" + }, + "RequestBody": [ + "\u003C?xml version=\u00271.0\u0027 encoding=\u0027utf-8\u0027?\u003E\n", + "\u003CStorageServiceProperties\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003CCorsRule\u003E\u003CAllowedOrigins\u003Ewww.xyz.com\u003C/AllowedOrigins\u003E\u003CAllowedMethods\u003EGET\u003C/AllowedMethods\u003E\u003CAllowedHeaders /\u003E\u003CExposedHeaders /\u003E\u003CMaxAgeInSeconds\u003E0\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003C/StorageServiceProperties\u003E" + ], + "StatusCode": 400, + "ResponseHeaders": { + "Content-Length": "294", + "Content-Type": "application/xml", + "Date": "Tue, 11 Oct 2022 23:33:32 GMT", + "Server": [ + "Windows-Azure-File/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-error-code": "InvalidXmlDocument", + "x-ms-version": "2021-06-08" + }, + "ResponseBody": [ + "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CError\u003E\u003CCode\u003EInvalidXmlDocument\u003C/Code\u003E\u003CMessage\u003EXML specified is not syntactically valid.\n", + "RequestId:6631d6c6-901a-0018-3dc9-dd0844000000\n", + "Time:2022-10-11T23:33:33.2229808Z\u003C/Message\u003E\u003CLineNumber\u003E0\u003C/LineNumber\u003E\u003CLinePosition\u003E0\u003C/LinePosition\u003E\u003CReason /\u003E\u003C/Error\u003E" + ] + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_file_service_properties_async.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_file_service_properties_async.yaml deleted file mode 100644 index 0fcb6611e76a..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_file_service_properties_async.yaml +++ /dev/null @@ -1,118 +0,0 @@ -interactions: -- request: - body: ' - - 1.0falsefalse1.0falsefalsefalse' - headers: - Content-Length: - - '469' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:37 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: Fri, 18 Sep 2020 01:53:39 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - x-ms-version: '2020-02-10' - status: - code: 202 - message: Accepted - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -- request: - body: null - headers: - Accept: - - application/xml - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:40 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0falsefalse1.0falsefalsefalse" - headers: - content-type: application/xml - date: Fri, 18 Sep 2020 01:53:39 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - vary: Origin - x-ms-version: '2020-02-10' - status: - code: 200 - message: OK - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -- request: - body: ' - - 1.0falsefalse1.0falsefalsetrue' - headers: - Content-Length: - - '468' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:40 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: Fri, 18 Sep 2020 01:53:39 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - x-ms-version: '2020-02-10' - status: - code: 202 - message: Accepted - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -- request: - body: null - headers: - Accept: - - application/xml - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:40 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0falsefalse1.0falsefalsetrue" - headers: - content-type: application/xml - date: Fri, 18 Sep 2020 01:53:39 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - vary: Origin - x-ms-version: '2020-02-10' - status: - code: 200 - message: OK - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_cors_async.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_cors_async.yaml deleted file mode 100644 index 0181be1e5aa2..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_cors_async.yaml +++ /dev/null @@ -1,60 +0,0 @@ -interactions: -- request: - body: ' - - www.xyz.comGET0www.xyz.com,www.ab.com,www.bc.comGET,PUTx-ms-meta-data*,x-ms-meta-target*,x-ms-meta-xyz,x-ms-meta-foox-ms-meta-data*,x-ms-meta-source*,x-ms-meta-abc,x-ms-meta-bcd500' - headers: - Content-Length: - - '631' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:40 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: Fri, 18 Sep 2020 01:53:39 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - x-ms-version: '2020-02-10' - status: - code: 202 - message: Accepted - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -- request: - body: null - headers: - Accept: - - application/xml - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:40 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0falsefalse1.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true" - headers: - content-type: application/xml - date: Fri, 18 Sep 2020 01:53:39 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - vary: Origin - x-ms-version: '2020-02-10' - status: - code: 200 - message: OK - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_hour_metrics_async.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_hour_metrics_async.yaml deleted file mode 100644 index b82ba345dc86..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_hour_metrics_async.yaml +++ /dev/null @@ -1,59 +0,0 @@ -interactions: -- request: - body: ' - - 1.0truetruetrue5' - headers: - Content-Length: - - '267' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:41 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: Fri, 18 Sep 2020 01:53:40 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - x-ms-version: '2020-02-10' - status: - code: 202 - message: Accepted - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -- request: - body: null - headers: - Accept: - - application/xml - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:41 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0truetruetrue51.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true" - headers: - content-type: application/xml - date: Fri, 18 Sep 2020 01:53:40 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - vary: Origin - x-ms-version: '2020-02-10' - status: - code: 200 - message: OK - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_minute_metrics_async.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_minute_metrics_async.yaml deleted file mode 100644 index 0eca84a4c4f9..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_set_minute_metrics_async.yaml +++ /dev/null @@ -1,59 +0,0 @@ -interactions: -- request: - body: ' - - 1.0truetruetrue5' - headers: - Content-Length: - - '271' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:42 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: '' - headers: - date: Fri, 18 Sep 2020 01:53:41 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - x-ms-version: '2020-02-10' - status: - code: 202 - message: Accepted - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -- request: - body: null - headers: - Accept: - - application/xml - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:43 GMT - x-ms-version: - - '2020-02-10' - method: GET - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFF1.0truetruetrue51.0truetruetrue5GETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true" - headers: - content-type: application/xml - date: Fri, 18 Sep 2020 01:53:41 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - vary: Origin - x-ms-version: '2020-02-10' - status: - code: 200 - message: OK - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_too_many_cors_rules_async.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_too_many_cors_rules_async.yaml deleted file mode 100644 index 10dfe103177f..000000000000 --- a/sdk/storage/azure-storage-file-share/tests/recordings/test_file_service_properties_async.test_too_many_cors_rules_async.yaml +++ /dev/null @@ -1,41 +0,0 @@ -interactions: -- request: - body: ' - - www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0' - headers: - Content-Length: - - '1143' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - azsdk-python-storage-file-share/12.2.0 Python/3.8.5 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 18 Sep 2020 01:53:43 GMT - x-ms-version: - - '2020-02-10' - method: PUT - uri: https://storagename.file.core.windows.net/?restype=service&comp=properties - response: - body: - string: "\uFEFFInvalidXmlDocumentXML - specified is not syntactically valid.\nRequestId:800a2c58-901a-0025-3d5e-8d9f30000000\nTime:2020-09-18T01:53:42.5260418Z00" - headers: - content-length: '294' - content-type: application/xml - date: Fri, 18 Sep 2020 01:53:42 GMT - server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - x-ms-error-code: InvalidXmlDocument - x-ms-version: '2020-02-10' - status: - code: 400 - message: XML specified is not syntactically valid. - url: https://seancanarypremiumfile.file.core.windows.net/?restype=service&comp=properties -version: 1 diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_service_properties.py b/sdk/storage/azure-storage-file-share/tests/test_file_service_properties.py index c2acdb2a2536..8aaed6923f2d 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_service_properties.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_service_properties.py @@ -1,33 +1,30 @@ -# coding: utf-8 - # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -import unittest +import os import pytest - from azure.core.exceptions import HttpResponseError - from azure.storage.fileshare import ( - ShareServiceClient, - Metrics, CorsRule, + Metrics, RetentionPolicy, - ShareSmbSettings, - SmbMultichannel, ShareProtocolSettings, + ShareServiceClient, + ShareSmbSettings, + SmbMultichannel ) -from devtools_testutils.storage import StorageTestCase +from devtools_testutils import recorded_by_proxy +from devtools_testutils.storage import StorageRecordedTestCase from settings.testcase import FileSharePreparer # ------------------------------------------------------------------------------ -class FileServicePropertiesTest(StorageTestCase): +class TestFileServiceProperties(StorageRecordedTestCase): def _setup(self, storage_account_name, storage_account_key): url = self.account_url(storage_account_name, "file") credential = storage_account_key @@ -42,39 +39,42 @@ def _teardown(self, FILE_PATH): # --Helpers----------------------------------------------------------------- def _assert_metrics_equal(self, metrics1, metrics2): if metrics1 is None or metrics2 is None: - self.assertEqual(metrics1, metrics2) + assert metrics1 == metrics2 return - self.assertEqual(metrics1.version, metrics2.version) - self.assertEqual(metrics1.enabled, metrics2.enabled) - self.assertEqual(metrics1.include_apis, metrics2.include_apis) + assert metrics1.version == metrics2.version + assert metrics1.enabled == metrics2.enabled + assert metrics1.include_apis == metrics2.include_apis self._assert_retention_equal(metrics1.retention_policy, metrics2.retention_policy) def _assert_cors_equal(self, cors1, cors2): if cors1 is None or cors2 is None: - self.assertEqual(cors1, cors2) + assert cors1 == cors2 return - self.assertEqual(len(cors1), len(cors2)) + assert len(cors1) == len(cors2) for i in range(0, len(cors1)): rule1 = cors1[i] rule2 = cors2[i] - self.assertEqual(len(rule1.allowed_origins), len(rule2.allowed_origins)) - self.assertEqual(len(rule1.allowed_methods), len(rule2.allowed_methods)) - self.assertEqual(rule1.max_age_in_seconds, rule2.max_age_in_seconds) - self.assertEqual(len(rule1.exposed_headers), len(rule2.exposed_headers)) - self.assertEqual(len(rule1.allowed_headers), len(rule2.allowed_headers)) + assert len(rule1.allowed_origins) == len(rule2.allowed_origins) + assert len(rule1.allowed_methods) == len(rule2.allowed_methods) + assert rule1.max_age_in_seconds == rule2.max_age_in_seconds + assert len(rule1.exposed_headers) == len(rule2.exposed_headers) + assert len(rule1.allowed_headers) == len(rule2.allowed_headers) def _assert_retention_equal(self, ret1, ret2): - self.assertEqual(ret1.enabled, ret2.enabled) - self.assertEqual(ret1.days, ret2.days) + assert ret1.enabled == ret2.enabled + assert ret1.days == ret2.days # --Test cases per service --------------------------------------- - @pytest.mark.playback_test_only @FileSharePreparer() - def test_file_service_properties(self, storage_account_name, storage_account_key): - self._setup(storage_account_name, storage_account_key) + @recorded_by_proxy + def test_file_service_properties(self, **kwargs): + premium_storage_file_account_name = kwargs.pop("premium_storage_file_account_name") + premium_storage_file_account_key = kwargs.pop("premium_storage_file_account_key") + + self._setup(premium_storage_file_account_name, premium_storage_file_account_key) protocol_properties1 = ShareProtocolSettings(smb=ShareSmbSettings(multichannel=SmbMultichannel(enabled=False))) protocol_properties2 = ShareProtocolSettings(smb=ShareSmbSettings(multichannel=SmbMultichannel(enabled=True))) @@ -83,29 +83,33 @@ def test_file_service_properties(self, storage_account_name, storage_account_key resp = self.fsc.set_service_properties( hour_metrics=Metrics(), minute_metrics=Metrics(), cors=list(), protocol=protocol_properties1) # Assert - self.assertIsNone(resp) + assert resp is None props = self.fsc.get_service_properties() self._assert_metrics_equal(props['hour_metrics'], Metrics()) self._assert_metrics_equal(props['minute_metrics'], Metrics()) self._assert_cors_equal(props['cors'], list()) - self.assertEqual(props['protocol'].smb.multichannel.enabled, False) + assert props['protocol'].smb.multichannel.enabled == False # Assert - with self.assertRaises(ValueError): + with pytest.raises(ValueError): ShareProtocolSettings(smb=ShareSmbSettings(multichannel=SmbMultichannel())) - with self.assertRaises(ValueError): + with pytest.raises(ValueError): ShareProtocolSettings(smb=ShareSmbSettings()) - with self.assertRaises(ValueError): + with pytest.raises(ValueError): ShareProtocolSettings() # Act self.fsc.set_service_properties( hour_metrics=Metrics(), minute_metrics=Metrics(), cors=list(), protocol=protocol_properties2) props = self.fsc.get_service_properties() - self.assertEqual(props['protocol'].smb.multichannel.enabled, True) + assert props['protocol'].smb.multichannel.enabled == True # --Test cases per feature --------------------------------------- @FileSharePreparer() - def test_set_hour_metrics(self, storage_account_name, storage_account_key): + @recorded_by_proxy + def test_set_hour_metrics(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -117,7 +121,11 @@ def test_set_hour_metrics(self, storage_account_name, storage_account_key): self._assert_metrics_equal(received_props['hour_metrics'], hour_metrics) @FileSharePreparer() - def test_set_minute_metrics(self, storage_account_name, storage_account_key): + @recorded_by_proxy + def test_set_minute_metrics(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -130,7 +138,11 @@ def test_set_minute_metrics(self, storage_account_name, storage_account_key): self._assert_metrics_equal(received_props['minute_metrics'], minute_metrics) @FileSharePreparer() - def test_set_cors(self, storage_account_name, storage_account_key): + @recorded_by_proxy + def test_set_cors(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) @@ -157,22 +169,30 @@ def test_set_cors(self, storage_account_name, storage_account_key): # --Test cases for errors --------------------------------------- @FileSharePreparer() - def test_retention_no_days(self, storage_account_name, storage_account_key): + @recorded_by_proxy + def test_retention_no_days(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) # Assert - self.assertRaises(ValueError, + pytest.raises(ValueError, RetentionPolicy, True, None) @FileSharePreparer() - def test_too_many_cors_rules(self, storage_account_name, storage_account_key): + @recorded_by_proxy + def test_too_many_cors_rules(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) cors = [] for i in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) # Assert - self.assertRaises(HttpResponseError, + pytest.raises(HttpResponseError, self.fsc.set_service_properties, None, None, cors) diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_service_properties_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_service_properties_async.py index 3b1c67afe353..6ffa16de8b27 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_service_properties_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_service_properties_async.py @@ -5,44 +5,33 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -import unittest -import asyncio +import os import pytest - from azure.core.exceptions import HttpResponseError -from azure.core.pipeline.transport import AioHttpTransport -from multidict import CIMultiDict, CIMultiDictProxy from azure.storage.fileshare import ( - Metrics, CorsRule, + Metrics, RetentionPolicy, ShareProtocolSettings, - SmbMultichannel, ShareSmbSettings, + SmbMultichannel ) from azure.storage.fileshare.aio import ShareServiceClient + +from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils.storage.aio import AsyncStorageRecordedTestCase from settings.testcase import FileSharePreparer -from devtools_testutils.storage.aio import AsyncStorageTestCase # ------------------------------------------------------------------------------ -class AiohttpTestTransport(AioHttpTransport): - """Workaround to vcrpy bug: https://github.com/kevin1024/vcrpy/pull/461 - """ - async def send(self, request, **config): - response = await super(AiohttpTestTransport, self).send(request, **config) - if not isinstance(response.headers, CIMultiDictProxy): - response.headers = CIMultiDictProxy(CIMultiDict(response.internal_response.headers)) - response.content_type = response.headers.get("content-type") - return response - - -class FileServicePropertiesTest(AsyncStorageTestCase): + + +class TestFileServicePropertiesAsync(AsyncStorageRecordedTestCase): def _setup(self, storage_account_name, storage_account_key): url = self.account_url(storage_account_name, "file") credential = storage_account_key - self.fsc = ShareServiceClient(url, credential=credential, transport=AiohttpTestTransport()) + self.fsc = ShareServiceClient(url, credential=credential) def _teardown(self, FILE_PATH): if os.path.isfile(FILE_PATH): @@ -53,40 +42,42 @@ def _teardown(self, FILE_PATH): # --Helpers----------------------------------------------------------------- def _assert_metrics_equal(self, metrics1, metrics2): if metrics1 is None or metrics2 is None: - self.assertEqual(metrics1, metrics2) + assert metrics1 == metrics2 return - self.assertEqual(metrics1.version, metrics2.version) - self.assertEqual(metrics1.enabled, metrics2.enabled) - self.assertEqual(metrics1.include_apis, metrics2.include_apis) + assert metrics1.version == metrics2.version + assert metrics1.enabled == metrics2.enabled + assert metrics1.include_apis == metrics2.include_apis self._assert_retention_equal(metrics1.retention_policy, metrics2.retention_policy) def _assert_cors_equal(self, cors1, cors2): if cors1 is None or cors2 is None: - self.assertEqual(cors1, cors2) + assert cors1 == cors2 return - self.assertEqual(len(cors1), len(cors2)) + assert len(cors1) == len(cors2) for i in range(0, len(cors1)): rule1 = cors1[i] rule2 = cors2[i] - self.assertEqual(len(rule1.allowed_origins), len(rule2.allowed_origins)) - self.assertEqual(len(rule1.allowed_methods), len(rule2.allowed_methods)) - self.assertEqual(rule1.max_age_in_seconds, rule2.max_age_in_seconds) - self.assertEqual(len(rule1.exposed_headers), len(rule2.exposed_headers)) - self.assertEqual(len(rule1.allowed_headers), len(rule2.allowed_headers)) + assert len(rule1.allowed_origins) == len(rule2.allowed_origins) + assert len(rule1.allowed_methods) == len(rule2.allowed_methods) + assert rule1.max_age_in_seconds == rule2.max_age_in_seconds + assert len(rule1.exposed_headers) == len(rule2.exposed_headers) + assert len(rule1.allowed_headers) == len(rule2.allowed_headers) def _assert_retention_equal(self, ret1, ret2): - self.assertEqual(ret1.enabled, ret2.enabled) - self.assertEqual(ret1.days, ret2.days) + assert ret1.enabled == ret2.enabled + assert ret1.days == ret2.days # --Test cases per service --------------------------------------- - @pytest.mark.playback_test_only @FileSharePreparer() - @AsyncStorageTestCase.await_prepared_test - async def test_file_service_properties_async(self, storage_account_name, storage_account_key): - self._setup(storage_account_name, storage_account_key) + @recorded_by_proxy_async + async def test_file_service_properties(self, **kwargs): + premium_storage_file_account_name = kwargs.pop("premium_storage_file_account_name") + premium_storage_file_account_key = kwargs.pop("premium_storage_file_account_key") + + self._setup(premium_storage_file_account_name, premium_storage_file_account_key) protocol_properties1 = ShareProtocolSettings(smb=ShareSmbSettings(multichannel=SmbMultichannel(enabled=False))) protocol_properties2 = ShareProtocolSettings(smb=ShareSmbSettings(multichannel=SmbMultichannel(enabled=True))) @@ -95,30 +86,33 @@ async def test_file_service_properties_async(self, storage_account_name, storage hour_metrics=Metrics(), minute_metrics=Metrics(), cors=list(), protocol=protocol_properties1) # Assert - self.assertIsNone(resp) + assert resp is None props = await self.fsc.get_service_properties() self._assert_metrics_equal(props['hour_metrics'], Metrics()) self._assert_metrics_equal(props['minute_metrics'], Metrics()) self._assert_cors_equal(props['cors'], list()) - self.assertEqual(props['protocol'].smb.multichannel.enabled, False) + assert props['protocol'].smb.multichannel.enabled == False # Assert - with self.assertRaises(ValueError): + with pytest.raises(ValueError): ShareProtocolSettings(smb=ShareSmbSettings(multichannel=SmbMultichannel())) - with self.assertRaises(ValueError): + with pytest.raises(ValueError): ShareProtocolSettings(smb=ShareSmbSettings()) - with self.assertRaises(ValueError): + with pytest.raises(ValueError): ShareProtocolSettings() # Act await self.fsc.set_service_properties( hour_metrics=Metrics(), minute_metrics=Metrics(), cors=list(), protocol=protocol_properties2) props = await self.fsc.get_service_properties() - self.assertEqual(props['protocol'].smb.multichannel.enabled, True) + assert props['protocol'].smb.multichannel.enabled == True # --Test cases per feature --------------------------------------- @FileSharePreparer() - @AsyncStorageTestCase.await_prepared_test - async def test_set_hour_metrics_async(self, storage_account_name, storage_account_key): + @recorded_by_proxy_async + async def test_set_hour_metrics(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -130,8 +124,11 @@ async def test_set_hour_metrics_async(self, storage_account_name, storage_accoun self._assert_metrics_equal(received_props['hour_metrics'], hour_metrics) @FileSharePreparer() - @AsyncStorageTestCase.await_prepared_test - async def test_set_minute_metrics_async(self, storage_account_name, storage_account_key): + @recorded_by_proxy_async + async def test_set_minute_metrics(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -144,8 +141,11 @@ async def test_set_minute_metrics_async(self, storage_account_name, storage_acco self._assert_metrics_equal(received_props['minute_metrics'], minute_metrics) @FileSharePreparer() - @AsyncStorageTestCase.await_prepared_test - async def test_set_cors_async(self, storage_account_name, storage_account_key): + @recorded_by_proxy_async + async def test_set_cors(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) @@ -171,16 +171,17 @@ async def test_set_cors_async(self, storage_account_name, storage_account_key): self._assert_cors_equal(received_props['cors'], cors) # --Test cases for errors --------------------------------------- - - @FileSharePreparer() - @AsyncStorageTestCase.await_prepared_test - async def test_too_many_cors_rules_async(self, storage_account_name, storage_account_key): + @recorded_by_proxy_async + async def test_too_many_cors_rules(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) cors = [] for i in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) # Assert - with self.assertRaises(HttpResponseError): + with pytest.raises(HttpResponseError): await self.fsc.set_service_properties(None, None, cors)