summarylogtreecommitdiffstats
path: root/botocore-2967.patch
blob: b23db7f4770eba61cf5b77a2aed24e27c186e2e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
diff -Naur awscli-2.15.40/tests/unit/botocore/test_client.py awscli-2.15.40_/tests/unit/botocore/test_client.py
--- awscli-2.15.40/tests/unit/botocore/test_client.py	2024-04-20 15:00:39.465686191 +0800
+++ awscli-2.15.40_/tests/unit/botocore/test_client.py	2024-04-20 15:07:29.335115713 +0800
@@ -960,7 +960,7 @@
         lines = [
             ('    Creates an iterator that will paginate through responses '
              'from :py:meth:`MyService.Client.test_operation`.'),
-            '    **Request Syntax** ',
+            '    **Request Syntax**',
             '    ::',
             '      response_iterator = paginator.paginate(',
             "          Foo='string',",
@@ -976,17 +976,17 @@
             '    :type Bar: string',
             '    :param Bar: Documents Bar',
             '    :type PaginationConfig: dict',
-            '    :param PaginationConfig: ',
+            '    :param PaginationConfig:',
             ('      A dictionary that provides parameters to control '
              'pagination.'),
-            '      - **MaxItems** *(integer) --* ',
+            '      - **MaxItems** *(integer) --*',
             ('        The total number of items to return. If the total '
              'number of items available is more than the value specified '
              'in max-items then a ``NextToken`` will be provided in the '
              'output that you can use to resume pagination.'),
-            '      - **PageSize** *(integer) --* ',
+            '      - **PageSize** *(integer) --*',
             '        The size of each page.',
-            '      - **StartingToken** *(string) --* ',
+            '      - **StartingToken** *(string) --*',
             ('        A token to specify where to start paginating. This is '
              'the ``NextToken`` from a previous response.'),
             '    :returns: None',
diff -Naur awscli-2.15.40/tests/unit/botocore/test_waiters.py awscli-2.15.40_/tests/unit/botocore/test_waiters.py
--- awscli-2.15.40/tests/unit/botocore/test_waiters.py	2024-04-20 15:00:39.469019486 +0800
+++ awscli-2.15.40_/tests/unit/botocore/test_waiters.py	2024-04-20 15:04:08.810188250 +0800
@@ -648,7 +648,7 @@
             ('    Polls :py:meth:`MyService.Client.foo` every 1 '
              'seconds until a successful state is reached. An error '
              'is returned after 1 failed checks.'),
-            '    **Request Syntax** ',
+            '    **Request Syntax**',
             '    ::',
             '      waiter.wait(',
             "          bar='string'",
diff -Naur awscli-2.15.40/tests/unit/botocore/test_utils.py awscli-2.15.40_/tests/unit/botocore/test_utils.py
--- awscli-2.15.40/tests/unit/botocore/test_utils.py	2024-04-20 12:09:38.883650919 +0800
+++ awscli-2.15.40_/tests/unit/botocore/test_utils.py	2024-04-20 12:11:56.434812142 +0800
@@ -1000,17 +1000,24 @@
                          'https://bucket.s3.amazonaws.com/key.txt')
 
 
-class TestSwitchToChunkedEncodingForNonSeekableObjects(unittest.TestCase):
-    def test_switch_to_chunked_encodeing_for_stream_like_object(self):
-        request = AWSRequest(
-            method='POST', headers={},
-            data=io.BufferedIOBase(b"some initial binary data"),
-            url='https://foo.amazonaws.com/bucket/key.txt'
-        )
-        prepared_request = request.prepare()
-        self.assertEqual(
-            prepared_request.headers, {'Transfer-Encoding': 'chunked'}
-        )
+def test_chunked_encoding_used_for_stream_like_object():
+    class BufferedStream(io.BufferedIOBase):
+        """Class to ensure seek/tell don't work, but read is implemented."""
+
+        def __init__(self, value):
+            self.value = io.BytesIO(value)
+
+        def read(self, size=-1):
+            return self.value.read(size)
+
+    request = AWSRequest(
+        method='POST',
+        headers={},
+        data=BufferedStream(b"some initial binary data"),
+        url='https://foo.amazonaws.com/bucket/key.txt',
+    )
+    prepared_request = request.prepare()
+    assert prepared_request.headers == {'Transfer-Encoding': 'chunked'}
 
 
 class TestInstanceCache(unittest.TestCase):