Exemple #1
0
 def test_copy_source_supports_optional_version_id(self):
     params = {"CopySource": {"Bucket": "foo", "Key": "keyname+", "VersionId": "asdf+"}}
     handlers.handle_copy_source_param(params)
     self.assertEqual(
         params["CopySource"],
         # Note, versionId is not url encoded.
         "foo/keyname%2B?versionId=asdf+",
     )
Exemple #2
0
 def test_copy_source_supports_optional_version_id(self):
     params = {
         'CopySource': {'Bucket': 'foo',
                        'Key': 'keyname+',
                        'VersionId': 'asdf+'}
     }
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'],
                      # Note, versionId is not url encoded.
                      'foo/keyname%2B?versionId=asdf+')
Exemple #3
0
 def test_copy_source_ignored_if_not_dict(self):
     params = {
         'CopySource': 'stringvalue'
     }
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'], 'stringvalue')
Exemple #4
0
 def test_copy_source_supports_dict(self):
     params = {
         'CopySource': {'Bucket': 'foo', 'Key': 'keyname+'}
     }
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'], 'foo/keyname%2B')
Exemple #5
0
 def test_copy_source_with_multiple_questions(self):
     params = {'CopySource': '/foo/bar+baz?a=baz+?versionId=a+'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'],
                      '/foo/bar%2Bbaz%3Fa%3Dbaz%2B?versionId=a+')
Exemple #6
0
 def test_only_quote_url_path_not_version_id(self):
     params = {"CopySource": "/foo/bar++baz?versionId=123"}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params["CopySource"], "/foo/bar%2B%2Bbaz?versionId=123")
 def test_copy_source_supports_dict(self):
     params = {'CopySource': {'Bucket': 'foo', 'Key': 'keyname+'}}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'], 'foo/keyname%2B')
 def test_only_version_id_is_special_cased(self):
     params = {'CopySource': '/foo/bar++baz?notVersion=foo+'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'],
                      '/foo/bar%2B%2Bbaz%3FnotVersion%3Dfoo%2B')
 def test_quote_source_header_needs_no_changes(self):
     params = {'CopySource': '/foo/bar?versionId=123'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'], '/foo/bar?versionId=123')
Exemple #10
0
 def test_copy_source_has_validation_failure(self):
     with self.assertRaisesRegexp(ParamValidationError, "Key"):
         handlers.handle_copy_source_param({"CopySource": {"Bucket": "foo"}})
Exemple #11
0
 def test_copy_source_ignored_if_not_dict(self):
     params = {"CopySource": "stringvalue"}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params["CopySource"], "stringvalue")
Exemple #12
0
 def test_copy_source_supports_dict(self):
     params = {"CopySource": {"Bucket": "foo", "Key": "keyname+"}}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params["CopySource"], "foo/keyname%2B")
Exemple #13
0
 def test_copy_source_with_multiple_questions(self):
     params = {"CopySource": "/foo/bar+baz?a=baz+?versionId=a+"}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params["CopySource"], "/foo/bar%2Bbaz%3Fa%3Dbaz%2B?versionId=a+")
Exemple #14
0
 def test_only_version_id_is_special_cased(self):
     params = {"CopySource": "/foo/bar++baz?notVersion=foo+"}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params["CopySource"], "/foo/bar%2B%2Bbaz%3FnotVersion%3Dfoo%2B")
Exemple #15
0
 def test_copy_source_has_validation_failure(self):
     with self.assertRaisesRegexp(ParamValidationError, 'Key'):
         handlers.handle_copy_source_param(
             {'CopySource': {'Bucket': 'foo'}})
 def test_copy_source_has_validation_failure(self):
     with self.assertRaisesRegexp(ParamValidationError, 'Key'):
         handlers.handle_copy_source_param(
             {'CopySource': {
                 'Bucket': 'foo'
             }})
Exemple #17
0
 def test_quote_source_header_needs_no_changes(self):
     params = {'CopySource': '/foo/bar?versionId=123'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'],
                      '/foo/bar?versionId=123')
 def test_only_quote_url_path_not_version_id(self):
     params = {'CopySource': '/foo/bar++baz?versionId=123'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'],
                      '/foo/bar%2B%2Bbaz?versionId=123')
Exemple #19
0
 def test_only_quote_url_path_not_version_id(self):
     params = {'CopySource': '/foo/bar++baz?versionId=123'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'],
                      '/foo/bar%2B%2Bbaz?versionId=123')
 def test_copy_source_with_multiple_questions(self):
     params = {'CopySource': '/foo/bar+baz?a=baz+?versionId=a+'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'],
                      '/foo/bar%2Bbaz%3Fa%3Dbaz%2B?versionId=a+')
Exemple #21
0
 def test_only_version_id_is_special_cased(self):
     params = {'CopySource': '/foo/bar++baz?notVersion=foo+'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'],
                      '/foo/bar%2B%2Bbaz%3FnotVersion%3Dfoo%2B')
 def test_copy_source_ignored_if_not_dict(self):
     params = {'CopySource': 'stringvalue'}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params['CopySource'], 'stringvalue')
Exemple #23
0
 def test_quote_source_header_needs_no_changes(self):
     params = {"CopySource": "/foo/bar?versionId=123"}
     handlers.handle_copy_source_param(params)
     self.assertEqual(params["CopySource"], "/foo/bar?versionId=123")