# Path: baroque/defaults/events.py
# class EventFactory:
#     """A factory class that exposes methods to quickly create useful
#     :obj:`baroque.entities.event.Event` instances"""
# 
#     @classmethod
#     def new(cls, **kwargs):
#         """Factory method returning a generic type event.
#     
#         Args:
#             **kwargs: positional arguments for `Event` instantiation
#     
#         Returns:
#             :obj:`baroque.entities.event.Event`
#     
#         """
#         return Event(GenericEventType(), **kwargs)
# 
# Path: baroque/defaults/eventtypes.py
# class GenericEventType(EventType):
#     """Describes generic events with a free-form content.
# 
#     Args:
#         owner (str, optional): ID of the owner of this event type.
# 
#     """
#     def __init__(self, owner=None):
#         EventType.__init__(self,
#                            '''{
#                              "$schema": "http://json-schema.org/draft-04/schema#"
#                            }''',
#                            description='Generic event',
#                            owner=owner)


from baroque.defaults.events import EventFactory
from baroque.defaults.eventtypes import GenericEventType


def test_new():
    payload = dict(test='value')
    description = 'a test event'
    owner = 'me'
    evt = EventFactory.new(payload=payload, description=description, owner=owner)
    assert isinstance(evt.type, GenericEventType)

# Path: baroque/defaults/events.py
# class EventFactory:
#     """A factory class that exposes methods to quickly create useful
#     :obj:`baroque.entities.event.Event` instances"""
# 
#     @classmethod
#     def new(cls, **kwargs):
#         """Factory method returning a generic type event.
#     
#         Args:
#             **kwargs: positional arguments for `Event` instantiation
#     
#         Returns:
#             :obj:`baroque.entities.event.Event`
#     
#         """
#         return Event(GenericEventType(), **kwargs)
# 
# Path: baroque/defaults/eventtypes.py
# class GenericEventType(EventType):
#     """Describes generic events with a free-form content.
# 
#     Args:
#         owner (str, optional): ID of the owner of this event type.
# 
#     """
#     def __init__(self, owner=None):
#         EventType.__init__(self,
#                            '''{
#                              "$schema": "http://json-schema.org/draft-04/schema#"
#                            }''',
#                            description='Generic event',
#                            owner=owner)


# Path: tests/defaults/test_events.py
from baroque.defaults.events import EventFactory
from baroque.defaults.eventtypes import GenericEventType



def test_new():
    payload = dict(test='value')
    description = 'a test event'
    owner = 'me'
    evt = EventFactory.new(payload=payload, description=description, owner=owner)
    assert isinstance(evt.type, GenericEventType)

    assert evt.payload == payload