Skip to content

Commit e6cdd05

Browse files
[Storage] Fix create_if_not_exists() docstrings and tests (Azure#23751)
1 parent 608ce6c commit e6cdd05

File tree

36 files changed

+229
-231
lines changed

36 files changed

+229
-231
lines changed

sdk/storage/azure-storage-blob/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Features Added
66
- Added support for service version 2021-06-08.
7-
- Added support for `create_if_not_exists()` for `BlobContainerClient`
7+
- Added support for `create_container_if_not_exists()` for `BlobContainerClient`
88

99
## 12.11.0 (2022-03-29)
1010

sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def create_container(self, metadata=None, public_access=None, **kwargs):
304304
process_storage_error(error)
305305

306306
@distributed_trace
307-
def create_if_not_exists(self, **kwargs):
307+
def create_container_if_not_exists(self, **kwargs):
308308
# type: (**Any) -> None
309309
"""
310310
Creates a new container under the specified account. If the container

sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ async def create_container(self, metadata=None, public_access=None, **kwargs):
169169
process_storage_error(error)
170170

171171
@distributed_trace_async
172-
async def create_if_not_exists(self, **kwargs):
172+
async def create_container_if_not_exists(self, **kwargs):
173173
# type: (**Any) -> None
174174
"""
175175
Creates a new container under the specified account. If the container

sdk/storage/azure-storage-blob/tests/recordings/test_container.test_create_container_if_not_exists_with_existing_container.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ interactions:
1111
Content-Length:
1212
- '0'
1313
User-Agent:
14-
- azsdk-python-storage-blob/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
14+
- azsdk-python-storage-blob/12.12.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
1515
x-ms-date:
16-
- Fri, 18 Mar 2022 18:56:41 GMT
16+
- Wed, 30 Mar 2022 21:22:44 GMT
1717
x-ms-version:
18-
- '2021-04-10'
18+
- '2021-06-08'
1919
method: PUT
2020
uri: https://storagename.blob.core.windows.net/container785a1eaa?restype=container
2121
response:
@@ -25,15 +25,15 @@ interactions:
2525
content-length:
2626
- '0'
2727
date:
28-
- Fri, 18 Mar 2022 18:56:40 GMT
28+
- Wed, 30 Mar 2022 21:22:44 GMT
2929
etag:
30-
- '"0x8DA0911096F64AA"'
30+
- '"0x8DA12936E6CC3E6"'
3131
last-modified:
32-
- Fri, 18 Mar 2022 18:56:40 GMT
32+
- Wed, 30 Mar 2022 21:22:44 GMT
3333
server:
3434
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
3535
x-ms-version:
36-
- '2021-04-10'
36+
- '2021-06-08'
3737
status:
3838
code: 201
3939
message: Created
@@ -49,30 +49,30 @@ interactions:
4949
Content-Length:
5050
- '0'
5151
User-Agent:
52-
- azsdk-python-storage-blob/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
52+
- azsdk-python-storage-blob/12.12.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
5353
x-ms-date:
54-
- Fri, 18 Mar 2022 18:56:42 GMT
54+
- Wed, 30 Mar 2022 21:22:45 GMT
5555
x-ms-version:
56-
- '2021-04-10'
56+
- '2021-06-08'
5757
method: PUT
5858
uri: https://storagename.blob.core.windows.net/container785a1eaa?restype=container
5959
response:
6060
body:
6161
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>ContainerAlreadyExists</Code><Message>The
62-
specified container already exists.\nRequestId:6c8fa979-201e-008a-05f9-3a8173000000\nTime:2022-03-18T18:56:40.4555247Z</Message></Error>"
62+
specified container already exists.\nRequestId:be779b14-901e-006b-497c-445d36000000\nTime:2022-03-30T21:22:44.9260314Z</Message></Error>"
6363
headers:
6464
content-length:
6565
- '230'
6666
content-type:
6767
- application/xml
6868
date:
69-
- Fri, 18 Mar 2022 18:56:40 GMT
69+
- Wed, 30 Mar 2022 21:22:44 GMT
7070
server:
7171
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
7272
x-ms-error-code:
7373
- ContainerAlreadyExists
7474
x-ms-version:
75-
- '2021-04-10'
75+
- '2021-06-08'
7676
status:
7777
code: 409
7878
message: The specified container already exists.

sdk/storage/azure-storage-blob/tests/recordings/test_container.test_create_container_if_not_exists_without_existing_container.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ interactions:
1111
Content-Length:
1212
- '0'
1313
User-Agent:
14-
- azsdk-python-storage-blob/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
14+
- azsdk-python-storage-blob/12.12.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
1515
x-ms-date:
16-
- Fri, 18 Mar 2022 18:56:48 GMT
16+
- Wed, 30 Mar 2022 21:22:36 GMT
1717
x-ms-version:
18-
- '2021-04-10'
18+
- '2021-06-08'
1919
method: PUT
2020
uri: https://storagename.blob.core.windows.net/containerd8c72002?restype=container
2121
response:
@@ -25,15 +25,15 @@ interactions:
2525
content-length:
2626
- '0'
2727
date:
28-
- Fri, 18 Mar 2022 18:56:46 GMT
28+
- Wed, 30 Mar 2022 21:22:36 GMT
2929
etag:
30-
- '"0x8DA09110D2893BD"'
30+
- '"0x8DA129369B4AC8A"'
3131
last-modified:
32-
- Fri, 18 Mar 2022 18:56:46 GMT
32+
- Wed, 30 Mar 2022 21:22:36 GMT
3333
server:
3434
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
3535
x-ms-version:
36-
- '2021-04-10'
36+
- '2021-06-08'
3737
status:
3838
code: 201
3939
message: Created

sdk/storage/azure-storage-blob/tests/recordings/test_container_async.test_create_container_if_not_exists_with_existing_container.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ interactions:
55
Accept:
66
- application/xml
77
User-Agent:
8-
- azsdk-python-storage-blob/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
8+
- azsdk-python-storage-blob/12.12.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
99
x-ms-date:
10-
- Fri, 18 Mar 2022 19:01:59 GMT
10+
- Wed, 30 Mar 2022 21:23:02 GMT
1111
x-ms-version:
12-
- '2021-04-10'
12+
- '2021-06-08'
1313
method: PUT
1414
uri: https://storagename.blob.core.windows.net/acontainer399c2127?restype=container
1515
response:
1616
body:
1717
string: ''
1818
headers:
1919
content-length: '0'
20-
date: Fri, 18 Mar 2022 19:01:56 GMT
21-
etag: '"0x8DA0911C6843F7F"'
22-
last-modified: Fri, 18 Mar 2022 19:01:57 GMT
20+
date: Wed, 30 Mar 2022 21:23:01 GMT
21+
etag: '"0x8DA129378BE5DFF"'
22+
last-modified: Wed, 30 Mar 2022 21:23:02 GMT
2323
server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
24-
x-ms-version: '2021-04-10'
24+
x-ms-version: '2021-06-08'
2525
status:
2626
code: 201
2727
message: Created
@@ -32,24 +32,24 @@ interactions:
3232
Accept:
3333
- application/xml
3434
User-Agent:
35-
- azsdk-python-storage-blob/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
35+
- azsdk-python-storage-blob/12.12.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
3636
x-ms-date:
37-
- Fri, 18 Mar 2022 19:01:59 GMT
37+
- Wed, 30 Mar 2022 21:23:02 GMT
3838
x-ms-version:
39-
- '2021-04-10'
39+
- '2021-06-08'
4040
method: PUT
4141
uri: https://storagename.blob.core.windows.net/acontainer399c2127?restype=container
4242
response:
4343
body:
4444
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>ContainerAlreadyExists</Code><Message>The
45-
specified container already exists.\nRequestId:6b597129-701e-0001-51fa-3a851e000000\nTime:2022-03-18T19:01:57.6645912Z</Message></Error>"
45+
specified container already exists.\nRequestId:397f4f94-a01e-003d-297c-44acd9000000\nTime:2022-03-30T21:23:02.2260400Z</Message></Error>"
4646
headers:
4747
content-length: '230'
4848
content-type: application/xml
49-
date: Fri, 18 Mar 2022 19:01:56 GMT
49+
date: Wed, 30 Mar 2022 21:23:01 GMT
5050
server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
5151
x-ms-error-code: ContainerAlreadyExists
52-
x-ms-version: '2021-04-10'
52+
x-ms-version: '2021-06-08'
5353
status:
5454
code: 409
5555
message: The specified container already exists.

sdk/storage/azure-storage-blob/tests/recordings/test_container_async.test_create_container_if_not_exists_without_existing_container.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ interactions:
55
Accept:
66
- application/xml
77
User-Agent:
8-
- azsdk-python-storage-blob/12.10.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
8+
- azsdk-python-storage-blob/12.12.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0)
99
x-ms-date:
10-
- Fri, 18 Mar 2022 19:01:52 GMT
10+
- Wed, 30 Mar 2022 21:22:56 GMT
1111
x-ms-version:
12-
- '2021-04-10'
12+
- '2021-06-08'
1313
method: PUT
1414
uri: https://storagename.blob.core.windows.net/acontainera180227f?restype=container
1515
response:
1616
body:
1717
string: ''
1818
headers:
1919
content-length: '0'
20-
date: Fri, 18 Mar 2022 19:01:50 GMT
21-
etag: '"0x8DA0911C28A275B"'
22-
last-modified: Fri, 18 Mar 2022 19:01:50 GMT
20+
date: Wed, 30 Mar 2022 21:22:56 GMT
21+
etag: '"0x8DA1293756D6BAD"'
22+
last-modified: Wed, 30 Mar 2022 21:22:56 GMT
2323
server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
24-
x-ms-version: '2021-04-10'
24+
x-ms-version: '2021-06-08'
2525
status:
2626
code: 201
2727
message: Created

sdk/storage/azure-storage-blob/tests/test_container.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_create_container_if_not_exists_without_existing_container(self, storage
8787

8888
# Act
8989
container = bsc.get_container_client(container_name)
90-
created = container.create_if_not_exists()
90+
created = container.create_container_if_not_exists()
9191

9292
# Assert
9393
self.assertTrue(created)
@@ -100,7 +100,7 @@ def test_create_container_if_not_exists_with_existing_container(self, storage_ac
100100
# Act
101101
container = bsc.get_container_client(container_name)
102102
container.create_container()
103-
created = container.create_if_not_exists()
103+
created = container.create_container_if_not_exists()
104104

105105
# Assert
106106
self.assertIsNone(created)

sdk/storage/azure-storage-blob/tests/test_container_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async def test_create_container_if_not_exists_without_existing_container(self, s
106106

107107
# Act
108108
container = bsc.get_container_client(container_name)
109-
created = await container.create_if_not_exists()
109+
created = await container.create_container_if_not_exists()
110110

111111
# Assert
112112
self.assertTrue(created)
@@ -120,7 +120,7 @@ async def test_create_container_if_not_exists_with_existing_container(self, stor
120120
# Act
121121
container = bsc.get_container_client(container_name)
122122
await container.create_container()
123-
created = await container.create_if_not_exists()
123+
created = await container.create_container_if_not_exists()
124124

125125
# Assert
126126
self.assertIsNone(created)

sdk/storage/azure-storage-file-datalake/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 12.7.0b1 (Unreleased)
44

55
### Features Added
6-
- Added support for `create_if_not_exists()` for `FileSystemClient`
6+
- Added support for `create_file_system_if_not_exists()` for `FileSystemClient`
77

88
### Bugs Fixed
99
- Updated `create_file_system()` docstring to have the correct return-type of `None`

0 commit comments

Comments
 (0)