コード例 #1
0
 def test_get_flag_from_header_with_unset_true_for_metadata_headers(self):
   """Should return --remove-custom-metadata flag."""
   headers_to_expected_flag_map = {
       'x-goog-meta-foo': '--remove-custom-metadata=foo',
       'x-amz-meta-foo': '--remove-custom-metadata=foo',
       'x-amz-foo': '--remove-custom-headers=x-amz-foo',
   }
   for header, expected_flag in headers_to_expected_flag_map.items():
     result = shim_util.get_flag_from_header(header, 'fake_val', unset=True)
     self.assertEqual(result, expected_flag)
コード例 #2
0
 def test_get_flag_from_header_with_unset_true_for_precondition_headers(self):
   """Should return None."""
   # Ideally we should use parameterized, but avoiding adding a new dependency
   # just for the shim.
   for header in [
       'x-goog-if-generation-match',
       'x-goog-if-metageneration-match',
   ]:
     result = shim_util.get_flag_from_header(header, 'fake_val', unset=True)
     self.assertIsNone(result)
コード例 #3
0
 def test_get_flag_from_header_with_unset_true_for_data_transfer_headers(self):
   # Ideally we should use parameterized, but avoiding adding a new dependency
   # just for the shim.
   headers_to_expected_flag_map = {
       'Cache-Control': '--clear-cache-control',
       'Content-Disposition': '--clear-content-disposition',
       'Content-Encoding': '--clear-content-encoding',
       'Content-Language': '--clear-content-language',
       'Content-Type': '--clear-content-type',
       'custom-time': '--clear-custom-time',
   }
   for header, expected_flag in headers_to_expected_flag_map.items():
     result = shim_util.get_flag_from_header(header, 'fake_val', unset=True)
     self.assertEqual(result, expected_flag)
コード例 #4
0
 def test_get_flag_from_header_with_unset_true_for_invalid_header(self):
   """Should return None."""
   result = shim_util.get_flag_from_header('invalid_header',
                                           'fake_val',
                                           unset=True)
   self.assertIsNone(result)
コード例 #5
0
 def test_get_flag_from_header_with_unset_true_for_content_md5(self):
   """Should return None."""
   result = shim_util.get_flag_from_header('Content-MD5',
                                           'fake_val',
                                           unset=True)
   self.assertIsNone(result)