Skip to content

Commit

Permalink
[Storage] Migrate test_directory.py to test proxy (Azure#26519)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenttran-msft authored Oct 5, 2022
1 parent 37d598c commit 484ab9e
Show file tree
Hide file tree
Showing 159 changed files with 14,478 additions and 19,067 deletions.
57 changes: 28 additions & 29 deletions sdk/storage/azure-storage-file-share/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
# --------------------------------------------------------------------------
#
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import sys

# fixture needs to be visible from conftest
import os
import platform

import pytest

from devtools_testutils import (
add_general_regex_sanitizer,
add_header_regex_sanitizer,
add_oauth_response_sanitizer,
add_uri_string_sanitizer,
test_proxy
)

@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
tenant_id = os.environ.get("STORAGE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_oauth_response_sanitizer()

add_header_regex_sanitizer(key="x-ms-encryption-key", value="Sanitized")

# Ignore async tests for Python < 3.5
collect_ignore_glob = []
if sys.version_info < (3, 5):
collect_ignore_glob.append("*_async.py")
add_uri_string_sanitizer(target=".preprod.", value=".")
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"Entries": [
{
"RequestUri": "https://storagename.file.core.windows.net/utsharefb732c36?restype=share",
"RequestMethod": "PUT",
"RequestHeaders": {
"Accept": "application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "0",
"User-Agent": "azsdk-python-storage-file-share/12.10.0 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
"x-ms-date": "Wed, 28 Sep 2022 21:23:53 GMT",
"x-ms-version": "2021-06-08"
},
"RequestBody": null,
"StatusCode": 201,
"ResponseHeaders": {
"Content-Length": "0",
"Date": "Wed, 28 Sep 2022 21:23:51 GMT",
"ETag": "\u00220x8DAA197BE0C6EF8\u0022",
"Last-Modified": "Wed, 28 Sep 2022 21:23:52 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/utsharefb732c36/dir1?restype=directory",
"RequestMethod": "PUT",
"RequestHeaders": {
"Accept": "application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "0",
"User-Agent": "azsdk-python-storage-file-share/12.10.0 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
"x-ms-date": "Wed, 28 Sep 2022 21:23:54 GMT",
"x-ms-file-attributes": "none",
"x-ms-file-creation-time": "now",
"x-ms-file-last-write-time": "now",
"x-ms-file-permission": "inherit",
"x-ms-version": "2021-06-08"
},
"RequestBody": null,
"StatusCode": 201,
"ResponseHeaders": {
"Content-Length": "0",
"Date": "Wed, 28 Sep 2022 21:23:51 GMT",
"ETag": "\u00220x8DAA197BE23A58F\u0022",
"Last-Modified": "Wed, 28 Sep 2022 21:23:52 GMT",
"Server": [
"Windows-Azure-File/1.0",
"Microsoft-HTTPAPI/2.0"
],
"x-ms-file-attributes": "Directory",
"x-ms-file-change-time": "2022-09-28T21:23:52.8487311Z",
"x-ms-file-creation-time": "2022-09-28T21:23:52.8487311Z",
"x-ms-file-id": "13835128424026341376",
"x-ms-file-last-write-time": "2022-09-28T21:23:52.8487311Z",
"x-ms-file-parent-id": "0",
"x-ms-file-permission-key": "17100207456270243504*9622787259914961209",
"x-ms-request-server-encrypted": "true",
"x-ms-version": "2021-06-08"
},
"ResponseBody": null
}
],
"Variables": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"Entries": [
{
"RequestUri": "https://storagename.file.core.windows.net/utshare9c5331f9?restype=share",
"RequestMethod": "PUT",
"RequestHeaders": {
"Accept": "application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "0",
"User-Agent": "azsdk-python-storage-file-share/12.10.0 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
"x-ms-date": "Wed, 28 Sep 2022 21:23:55 GMT",
"x-ms-version": "2021-06-08"
},
"RequestBody": null,
"StatusCode": 201,
"ResponseHeaders": {
"Content-Length": "0",
"Date": "Wed, 28 Sep 2022 21:23:52 GMT",
"ETag": "\u00220x8DAA197BEBC450B\u0022",
"Last-Modified": "Wed, 28 Sep 2022 21:23:53 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/utshare9c5331f9/dir1?restype=directory",
"RequestMethod": "PUT",
"RequestHeaders": {
"Accept": "application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "0",
"User-Agent": "azsdk-python-storage-file-share/12.10.0 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
"x-ms-date": "Wed, 28 Sep 2022 21:23:55 GMT",
"x-ms-file-attributes": "none",
"x-ms-file-creation-time": "now",
"x-ms-file-last-write-time": "now",
"x-ms-file-permission": "inherit",
"x-ms-version": "2021-06-08"
},
"RequestBody": null,
"StatusCode": 201,
"ResponseHeaders": {
"Content-Length": "0",
"Date": "Wed, 28 Sep 2022 21:23:53 GMT",
"ETag": "\u00220x8DAA197BECDFD36\u0022",
"Last-Modified": "Wed, 28 Sep 2022 21:23:53 GMT",
"Server": [
"Windows-Azure-File/1.0",
"Microsoft-HTTPAPI/2.0"
],
"x-ms-file-attributes": "Directory",
"x-ms-file-change-time": "2022-09-28T21:23:53.9650870Z",
"x-ms-file-creation-time": "2022-09-28T21:23:53.9650870Z",
"x-ms-file-id": "13835128424026341376",
"x-ms-file-last-write-time": "2022-09-28T21:23:53.9650870Z",
"x-ms-file-parent-id": "0",
"x-ms-file-permission-key": "17100207456270243504*9622787259914961209",
"x-ms-request-server-encrypted": "true",
"x-ms-version": "2021-06-08"
},
"ResponseBody": null
},
{
"RequestUri": "https://storagename.file.core.windows.net/utshare9c5331f9/dir1?restype=directory",
"RequestMethod": "PUT",
"RequestHeaders": {
"Accept": "application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "0",
"User-Agent": "azsdk-python-storage-file-share/12.10.0 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
"x-ms-date": "Wed, 28 Sep 2022 21:23:55 GMT",
"x-ms-file-attributes": "none",
"x-ms-file-creation-time": "now",
"x-ms-file-last-write-time": "now",
"x-ms-file-permission": "inherit",
"x-ms-version": "2021-06-08"
},
"RequestBody": null,
"StatusCode": 409,
"ResponseHeaders": {
"Content-Length": "228",
"Content-Type": "application/xml",
"Date": "Wed, 28 Sep 2022 21:23:53 GMT",
"Server": [
"Windows-Azure-File/1.0",
"Microsoft-HTTPAPI/2.0"
],
"x-ms-error-code": "ResourceAlreadyExists",
"x-ms-version": "2021-06-08"
},
"ResponseBody": [
"\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CError\u003E\u003CCode\u003EResourceAlreadyExists\u003C/Code\u003E\u003CMessage\u003EThe specified resource already exists.\n",
"RequestId:f6f2ae1a-701a-0051-4e80-d3d02c000000\n",
"Time:2022-09-28T21:23:54.0678394Z\u003C/Message\u003E\u003C/Error\u003E"
]
}
],
"Variables": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"Entries": [
{
"RequestUri": "https://storagename.file.core.windows.net/utshare9d4b31f1?restype=share",
"RequestMethod": "PUT",
"RequestHeaders": {
"Accept": "application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "0",
"User-Agent": "azsdk-python-storage-file-share/12.10.0 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
"x-ms-date": "Wed, 28 Sep 2022 21:23:54 GMT",
"x-ms-version": "2021-06-08"
},
"RequestBody": null,
"StatusCode": 201,
"ResponseHeaders": {
"Content-Length": "0",
"Date": "Wed, 28 Sep 2022 21:23:52 GMT",
"ETag": "\u00220x8DAA197BE6223EC\u0022",
"Last-Modified": "Wed, 28 Sep 2022 21:23:53 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/utshare9d4b31f1/dir1?restype=directory",
"RequestMethod": "PUT",
"RequestHeaders": {
"Accept": "application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "0",
"User-Agent": "azsdk-python-storage-file-share/12.10.0 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
"x-ms-date": "Wed, 28 Sep 2022 21:23:54 GMT",
"x-ms-file-attributes": "none",
"x-ms-file-creation-time": "now",
"x-ms-file-last-write-time": "now",
"x-ms-file-permission": "inherit",
"x-ms-meta-hello": "world",
"x-ms-meta-number": "42",
"x-ms-version": "2021-06-08"
},
"RequestBody": null,
"StatusCode": 201,
"ResponseHeaders": {
"Content-Length": "0",
"Date": "Wed, 28 Sep 2022 21:23:52 GMT",
"ETag": "\u00220x8DAA197BE7478C3\u0022",
"Last-Modified": "Wed, 28 Sep 2022 21:23:53 GMT",
"Server": [
"Windows-Azure-File/1.0",
"Microsoft-HTTPAPI/2.0"
],
"x-ms-file-attributes": "Directory",
"x-ms-file-change-time": "2022-09-28T21:23:53.3784259Z",
"x-ms-file-creation-time": "2022-09-28T21:23:53.3784259Z",
"x-ms-file-id": "13835128424026341376",
"x-ms-file-last-write-time": "2022-09-28T21:23:53.3784259Z",
"x-ms-file-parent-id": "0",
"x-ms-file-permission-key": "17100207456270243504*9622787259914961209",
"x-ms-request-server-encrypted": "true",
"x-ms-version": "2021-06-08"
},
"ResponseBody": null
},
{
"RequestUri": "https://storagename.file.core.windows.net/utshare9d4b31f1/dir1?restype=directory",
"RequestMethod": "GET",
"RequestHeaders": {
"Accept": "application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"User-Agent": "azsdk-python-storage-file-share/12.10.0 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
"x-ms-date": "Wed, 28 Sep 2022 21:23:54 GMT",
"x-ms-version": "2021-06-08"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"Content-Length": "0",
"Date": "Wed, 28 Sep 2022 21:23:52 GMT",
"ETag": "\u00220x8DAA197BE7478C3\u0022",
"Last-Modified": "Wed, 28 Sep 2022 21:23:53 GMT",
"Server": [
"Windows-Azure-File/1.0",
"Microsoft-HTTPAPI/2.0"
],
"x-ms-file-attributes": "Directory",
"x-ms-file-change-time": "2022-09-28T21:23:53.3784259Z",
"x-ms-file-creation-time": "2022-09-28T21:23:53.3784259Z",
"x-ms-file-id": "13835128424026341376",
"x-ms-file-last-write-time": "2022-09-28T21:23:53.3784259Z",
"x-ms-file-parent-id": "0",
"x-ms-file-permission-key": "17100207456270243504*9622787259914961209",
"x-ms-meta-hello": "world",
"x-ms-meta-number": "42",
"x-ms-server-encrypted": "true",
"x-ms-version": "2021-06-08"
},
"ResponseBody": null
}
],
"Variables": {}
}
Loading

0 comments on commit 484ab9e

Please sign in to comment.