def METHOD_NAME(freeze_time, mocker, date, name_template, bucket_created, expected_name,
                                      expected_error):
    freeze_time(date)
    if '<' in name_template:
        storage = plugin.DynamicS3Storage(f'bucket_template={name_template},bucket_secret=secret')
    else:
        storage = plugin.S3Storage(f'bucket={name_template}')
    mocker.patch('indico_storage_s3.task.config', MockConfig())
    mocker.patch('indico_storage_s3.task.get_storage', return_value=storage)
    create_bucket_call = mocker.patch.object(plugin.DynamicS3Storage, '_create_bucket')
    if expected_error:
        with pytest.raises(expected_error):
            create_bucket()
    else:
        create_bucket()
    if bucket_created:
        token = hmac.new(b'secret', expected_name.encode(), hashlib.md5).hexdigest()
        create_bucket_call.assert_called_with(f'{expected_name}-{token}')
    else:
        assert not create_bucket_call.called