Esempio n. 1
0
 def test_not_an_error_message(self):
     parsed = {
         'Success': 'response',
         'ResponseMetadata': {}
     }
     expected = copy.deepcopy(parsed)
     s3errormsg.enhance_error_msg(parsed)
     # Nothing should have changed
     self.assertEqual(parsed, expected)
 def test_sigv4_error_message(self):
     parsed = {'Error': {'Message': 'Please use AWS4-HMAC-SHA256'}}
     s3errormsg.enhance_error_msg(parsed)
     # We should say how to fix the issue.
     self.assertIn('You can fix this issue', parsed['Error']['Message'])
     # We should mention the --region argument.
     self.assertIn('--region', parsed['Error']['Message'])
     # We should mention get-bucket-location
     self.assertIn('get-bucket-location', parsed['Error']['Message'])
Esempio n. 3
0
 def test_error_message_not_enhanced(self):
     parsed = {
         'Error': {
             'Message': 'This is a different error message.',
             'Code': 'Other Message'
         }
     }
     expected = copy.deepcopy(parsed)
     s3errormsg.enhance_error_msg(parsed)
     # Nothing should have changed
     self.assertEqual(parsed, expected)
 def test_error_message_not_enhanced(self):
     parsed = {
         'Error': {
             'Message': 'This is a different error message.',
             'Code': 'Other Message'
         }
     }
     expected = copy.deepcopy(parsed)
     s3errormsg.enhance_error_msg(parsed)
     # Nothing should have changed
     self.assertEqual(parsed, expected)
Esempio n. 5
0
 def test_301_error_message(self):
     parsed = {
         'Error': {
             'Code': 'PermanentRedirect',
             'Message': "Please use the correct endpoint.",
             'Endpoint': "myendpoint",
         }
     }
     s3errormsg.enhance_error_msg(parsed)
     # We should include the endpoint in the error message.
     error_message = parsed['Error']['Message']
     self.assertIn('myendpoint', error_message)
 def test_301_error_message(self):
     parsed = {
         'Error': {
             'Code': 'PermanentRedirect',
             'Message': "Please use the correct endpoint.",
             'Endpoint': "myendpoint",
         }
     }
     s3errormsg.enhance_error_msg(parsed)
     # We should include the endpoint in the error message.
     error_message = parsed['Error']['Message']
     self.assertIn('myendpoint', error_message)
Esempio n. 7
0
 def test_sigv4_error_message(self):
     parsed = {
         'Error': {
             'Message': 'Please use AWS4-HMAC-SHA256'
         }
     }
     s3errormsg.enhance_error_msg(parsed)
     # We should say how to fix the issue.
     self.assertIn('You can fix this issue',
                   parsed['Error']['Message'])
     # We should mention the --region argument.
     self.assertIn('--region', parsed['Error']['Message'])
     # We should mention get-bucket-location
     self.assertIn('get-bucket-location', parsed['Error']['Message'])
Esempio n. 8
0
 def test_kms_sigv4_error_message(self):
     parsed = {
         'Error': {
             'Message':
             ('Requests specifying Server Side Encryption with '
              'AWS KMS managed keys require AWS Signature Version 4.')
         }
     }
     s3errormsg.enhance_error_msg(parsed)
     # We should say how you enable it.
     self.assertIn('You can enable AWS Signature Version 4',
                   parsed['Error']['Message'])
     # We should mention the command that needs to be run.
     self.assertIn('aws configure set s3.signature_version s3v4',
                   parsed['Error']['Message'])
Esempio n. 9
0
 def test_kms_sigv4_error_message(self):
     parsed = {
         'Error': {
             'Message': (
                 'Requests specifying Server Side Encryption with '
                 'AWS KMS managed keys require AWS Signature Version 4.')
         }
     }
     s3errormsg.enhance_error_msg(parsed)
     # We should say how you enable it.
     self.assertIn('You can enable AWS Signature Version 4',
                   parsed['Error']['Message'])
     # We should mention the command that needs to be run.
     self.assertIn(
         'aws configure set s3.signature_version s3v4',
         parsed['Error']['Message'])
 def test_not_an_error_message(self):
     parsed = {'Success': 'response', 'ResponseMetadata': {}}
     expected = copy.deepcopy(parsed)
     s3errormsg.enhance_error_msg(parsed)
     # Nothing should have changed
     self.assertEqual(parsed, expected)