check that no extra kwargs are silently discarded

This commit is contained in:
Konstantin Lopuhin 2016-02-05 17:38:47 +03:00
parent d6bea3bf2e
commit bcb92b50dc
2 changed files with 7 additions and 0 deletions

View File

@ -68,6 +68,9 @@ class S3DownloadHandler(object):
except Exception as ex:
raise NotConfigured(str(ex))
else:
kw.pop('anon', None)
if kw:
raise TypeError('Unexpected keyword arguments: %s' % kw)
if not self.anon:
SignerCls = botocore.auth.AUTH_TYPE_MAPS['s3']
self._signer = SignerCls(botocore.credentials.Credentials(

View File

@ -500,6 +500,10 @@ class S3TestCase(BaseS3TestCase):
mock_formatdate.return_value = date
yield
def test_extra_kw(self):
with self.assertRaises(TypeError):
S3DownloadHandler(Settings(), extra_kw=True)
def test_request_signing1(self):
# gets an object from the johnsmith bucket.
date ='Tue, 27 Mar 2007 19:36:42 +0000'