CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-cloudinary

Python and Django SDK for Cloudinary, a cloud-based image and video management service with comprehensive transformation, optimization, and delivery capabilities

Overall
score

94%

Overview
Eval results
Files

task.mdevals/scenario-6/

Cloud Media Service Configuration Manager

Overview

Build a Python utility that manages configuration for a cloud-based media service. The utility must load credentials from environment variables and provide a simple way to verify the configuration is set up correctly.

Requirements

Create a module config_manager.py that implements the following functionality:

1. Configuration Loading

  • Load configuration from a URL-formatted environment variable
  • Support loading cloud name, API key, and API secret from the environment
  • Allow programmatic configuration setup (setting values via code)

2. Configuration Retrieval

  • Provide a way to retrieve the current configuration settings
  • Return the cloud name, API key, and API secret values

3. Configuration Validation

  • Check that all required parameters are set (cloud name, API key, API secret)
  • Raise a clear error if any required configuration is missing

Implementation Notes

  • Focus on configuration management only
  • The configuration should be retrievable for verification purposes
  • Keep the implementation straightforward

Test Cases { .test-cases }

Test Case 1: Load configuration from environment variable { .test-case @test }

File: test_config.py { .test-file }

Setup:

import os
os.environ['CLOUDINARY_URL'] = 'cloudinary://123456789012345:abcdefghijklmnopqrstuvwxyz123456@test-cloud'

Expected behavior:

  • Configuration manager successfully loads cloud name, API key, and API secret
  • Cloud name should be 'test-cloud'
  • API key should be '123456789012345'
  • API secret should be 'abcdefghijklmnopqrstuvwxyz123456'

Test Case 2: Missing configuration raises error { .test-case @test }

File: test_config.py { .test-file }

Setup:

import os
# Clear any existing Cloudinary configuration
for key in list(os.environ.keys()):
    if key.startswith('CLOUDINARY'):
        del os.environ[key]

Expected behavior:

  • Attempting to validate configuration without proper setup should raise an exception
  • The exception should indicate missing required configuration

Test Case 3: Manual configuration setup { .test-case @test }

File: test_config.py { .test-file }

Setup:

# No environment variables set

Expected behavior:

  • Configuration manager allows setting cloud name, API key, and API secret programmatically
  • Configuration can be retrieved to verify the values were set correctly
  • All three parameters (cloud_name, api_key, api_secret) should be accessible

Dependencies { .dependencies }

cloudinary { .dependency }

Python SDK for cloud-based media management service providing upload, transformation, and delivery capabilities.

Install with Tessl CLI

npx tessl i tessl/pypi-cloudinary

tile.json