CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-gntp

tessl install tessl/pypi-gntp@1.0.0

Growl Notification Transport Protocol for Python

Agent Success

Agent success rate when using this tile

80%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.25x

Baseline

Agent success rate without this tile

64%

task.mdevals/scenario-3/

Desktop Notification Service

Build a simple notification service that sends desktop notifications for different event types.

Requirements

Implement a notification service with the following functionality:

  1. Service Registration: The service must be able to register itself with a notification system, declaring the types of notifications it can send.

  2. Event Notifications: Support sending notifications for three types of events:

    • "Task Completed" events
    • "Warning" events
    • "Error" events
  3. Notification Details: Each notification should include:

    • A title describing the event
    • A detailed description/message
    • The event type
  4. Configuration: The service should support:

    • Configurable target host (default to localhost)
    • Configurable connection timeout
    • Optional password protection
  5. Default Behavior: By default, all three notification types should be enabled when registering the service.

Implementation

Create a Python module notification_service.py with:

  • A NotificationService class that manages the notification system
  • An __init__ method that accepts configuration parameters (hostname, port, password, timeout)
  • A setup() method that registers the service with the notification system
  • A send_notification(event_type, title, description) method that sends notifications

Test Cases { .test-cases }

Test Case 1: Basic Registration and Notification { .test-case }

# test_notification_service.py
from notification_service import NotificationService

def test_basic_notification():
    """Test that service can register and send a notification"""
    service = NotificationService(applicationName="TestApp")
    service.setup()

    # Should not raise an exception
    service.send_notification(
        event_type="Task Completed",
        title="Build Finished",
        description="The build completed successfully"
    )

Expected: Service registers successfully and sends notification without errors.

Test Case 2: Multiple Notification Types { .test-case }

# test_notification_service.py
from notification_service import NotificationService

def test_multiple_notification_types():
    """Test sending different notification types"""
    service = NotificationService(applicationName="TestApp")
    service.setup()

    # Send all three types
    service.send_notification("Task Completed", "Job Done", "Process finished")
    service.send_notification("Warning", "Low Memory", "Memory usage is high")
    service.send_notification("Error", "Connection Failed", "Unable to reach server")

Expected: All three notification types are sent successfully.

Test Case 3: Custom Configuration { .test-case }

# test_notification_service.py
from notification_service import NotificationService

def test_custom_configuration():
    """Test service with custom configuration"""
    service = NotificationService(
        applicationName="SecureApp",
        hostname="notification-server.local",
        port=23053,
        password="secret123"
    )
    service.setup()
    service.send_notification("Task Completed", "Test", "Custom config works")

Expected: Service connects to specified host with authentication.

Dependencies { .dependencies }

gntp { .dependency }

Provides Growl Notification Transport Protocol support for sending desktop notifications.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/gntp@1.0.x
tile.json