

def test_stat_encrypted_object_wildcard(self):
    'Tests stat command with a mix of encrypted and unencrypted objects.'
    if (self.test_api == ApiSelector.XML):
        return unittest.skip('gsutil does not support encryption with the XML API')
    bucket_uri = self.CreateBucket()
    object1_uri = self.CreateObject(bucket_uri=bucket_uri, object_name='foo1', contents=TEST_ENCRYPTION_CONTENT1, encryption_key=TEST_ENCRYPTION_KEY1)
    object2_uri = self.CreateObject(bucket_uri=bucket_uri, object_name='foo2', contents=TEST_ENCRYPTION_CONTENT2, encryption_key=TEST_ENCRYPTION_KEY2)
    object3_uri = self.CreateObject(bucket_uri=self, object_name='foo3', contents=TEST_ENCRYPTION_CONTENT3)
    stat_string = (suri(object1_uri)[:(- 2)] + '*')
    with SetBotoConfigForTest([('GSUtil', 'encryption_key', TEST_ENCRYPTION_KEY1)]):

        @Retry(AssertionError, tries=3, timeout_secs=1)
        def _StatExpectMixed():
            'Runs stat and validates output.'
            stdout = self.RunGsUtil(['stat', stat_string], return_stdout=True)
            self.assertIn(suri(object1_uri), stdout)
            self.assertIn(TEST_ENCRYPTION_CONTENT1_MD5, stdout)
            self.assertIn(TEST_ENCRYPTION_CONTENT1_CRC32C, stdout)
            self.assertIn(TEST_ENCRYPTION_KEY1_SHA256_B64, stdout)
            self.assertIn(suri(object2_uri), stdout)
            self.assertNotIn(TEST_ENCRYPTION_CONTENT2_MD5, stdout)
            self.assertNotIn(TEST_ENCRYPTION_CONTENT2_CRC32C, stdout)
            self.assertIn('encrypted', stdout)
            self.assertIn(TEST_ENCRYPTION_KEY2_SHA256_B64, stdout)
            self.assertIn(suri(object3_uri), stdout)
            self.assertIn(TEST_ENCRYPTION_CONTENT3_MD5, stdout)
            self.assertIn(TEST_ENCRYPTION_CONTENT3_CRC32C, stdout)
        _StatExpectMixed()

dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/tests/test_stat.py TestStat.test_stat_encrypted_object_wildcard/VarMisuse@96/203 `bucket_uri`->`self`