def test_bucket_scan_empty_bucket(self): manager = self.manager visitor = EncryptExtantKeys({'report-only': True}, manager, self.log_dir) result = visitor.process([{"Name": self.b}]) # Assert that we get the right remediated counts self.assertEqual( result, [{'Count': 0, 'Remediated': 0, 'Bucket': 'cloud-maid-ftest'}])
def test_encrypt_keys(self): self.generate_contents() manager = self.manager visitor = EncryptExtantKeys({}, manager, self.log_dir) result = visitor.process([{"Name": self.b}]) self.assertEqual( result, [{'Count': 3, 'Remediated': 3, 'Bucket': self.b}]) # Assert that we get the right remediated counts in the log self.assertTrue( "keys:3 remediated:3" in self.output.getvalue()) self.assertTrue( 'ServerSideEncryption' in self.client.head_object( Bucket=self.b, Key='home.txt'))