def test_create_bucket_default_obj_acl_skip(
            self, mock_update_notifications, mock_update_iam_policies,
            mock_update_acl_entities, mock_create_bucket_api_call,
            mock_add_target_project_to_kms_key, mock_bucket):
        """Tests that the create bucket happens without the notifications set"""
        self.parsed_args = common.get_mock_args()
        self.source_bucket = common.get_mock_source_bucket()
        details = bucket_details.BucketDetails(
            conf=self.parsed_args, source_bucket=self.source_bucket)
        details.notifications = None

        mock_bucket_instance = mock.MagicMock()
        mock_bucket.return_value = mock_bucket_instance

        bucket_mover_service._create_bucket(mock.MagicMock(), mock.MagicMock(),
                                            mock.MagicMock(), mock.MagicMock(),
                                            details)

        self.assertEqual(details.default_kms_key_name,
                         mock_bucket_instance.default_kms_key_name)
        mock_add_target_project_to_kms_key.assert_called_once()
        mock_bucket_instance.enable_logging.assert_called_once_with(
            details.logging['logBucket'], details.logging['logObjectPrefix'])
        mock_create_bucket_api_call.assert_called_once()
        mock_update_iam_policies.assert_called_once()
        self.assertEqual(2, mock_update_acl_entities.call_count)
        mock_bucket_instance.acl.save.assert_called_once()
        mock_bucket_instance.default_object_acl.save.assert_called_once()
        mock_update_notifications.assert_not_called()
 def setUp(self):
     self.parsed_args = common.get_mock_args()
     self.source_bucket = common.get_mock_source_bucket()
Пример #3
0
 def setUp(self):
     self.parsed_args = common.get_mock_args()