Growl Notification Transport Protocol for Python
80
Build a simple notification service that sends desktop notifications for different event types.
Implement a notification service with the following functionality:
Service Registration: The service must be able to register itself with a notification system, declaring the types of notifications it can send.
Event Notifications: Support sending notifications for three types of events:
Notification Details: Each notification should include:
Configuration: The service should support:
Default Behavior: By default, all three notification types should be enabled when registering the service.
Create a Python module notification_service.py with:
NotificationService class that manages the notification system__init__ method that accepts configuration parameters (hostname, port, password, timeout)setup() method that registers the service with the notification systemsend_notification(event_type, title, description) method that sends notifications# 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_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_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.
Provides Growl Notification Transport Protocol support for sending desktop notifications.
Install with Tessl CLI
npx tessl i tessl/pypi-gntpevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10