1
# Copyright 2011 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Long-poll interface tests."""
8
from zope.component import adaptedBy
9
from zope.interface import Interface
11
from lp.services.longpoll.interfaces import (
15
from lp.testing import TestCase
18
class IEventSourceInterface(Interface):
19
"""Test interface for an event source."""
22
class IEventSpecifierInterface(Interface):
23
"""Test interface for an event specifier."""
26
class TestLongPollInterfaces(TestCase):
28
def test_long_poll_event(self):
29
# long_poll_event is a class decorator that declares a class as an
31
@long_poll_event(IEventSourceInterface, IEventSpecifierInterface)
33
"""An example event source."""
34
self.assertTrue(ILongPollEvent.implementedBy(Something))
36
(IEventSourceInterface, IEventSpecifierInterface),
39
def test_long_poll_event_default(self):
40
# By default, long_poll_event assumes that the event spec is
42
@long_poll_event(IEventSourceInterface)
44
"""An example event source."""
45
self.assertTrue(ILongPollEvent.implementedBy(Something))
47
(IEventSourceInterface, basestring),