Source

araldo / test / endpoints_test.py

Full commit
import pytest
from gevent.queue import Queue
from araldo.endpoints import PluginException
from araldo.endpoints import InBoundBase, OutBoundBase


@pytest.fixture
def queue():
    return Queue()


def test_plugin_exception():
    exception = PluginException("testmessage")
    assert "testmessage" == str(exception)


def test_inbound_instantiation(queue):
    class C(InBoundBase):
        pass
    conf = {}
    c = C("testname", conf, queue)
    assert "testname" == c.name()
    assert conf == c.config()
    assert queue == c.gevent_queue


def test_outbound_instantiation():
    class C(OutBoundBase):
        pass
    conf = {}
    c = C("testname", conf)
    assert conf == c.config()
    assert "testname" == c.name()