How to use tomodachi - 10 common examples

To help you get started, we’ve selected a few tomodachi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kalaspuff / tomodachi / tests / services / mock_decorator_service.py View on Github external
import tomodachi
from tomodachi.transport.aws_sns_sqs import aws_sns_sqs


@tomodachi.service
class MockDecoratorService(tomodachi.Service):
    name = 'mock_decorator'
    log_level = 'INFO'
    function_tested = False

    @aws_sns_sqs('test-topic')
    async def test(self, default_value: bool = True) -> None:
        self.function_tested = default_value
github kalaspuff / tomodachi / tests / services / mock_decorator_service.py View on Github external
import tomodachi
from tomodachi.transport.aws_sns_sqs import aws_sns_sqs


@tomodachi.service
class MockDecoratorService(tomodachi.Service):
    name = 'mock_decorator'
    log_level = 'INFO'
    function_tested = False

    @aws_sns_sqs('test-topic')
    async def test(self, default_value: bool = True) -> None:
        self.function_tested = default_value
github kalaspuff / tomodachi / tests / test_cli.py View on Github external
def test_cli_start_exception_service_init(monkeypatch: Any, capsys: Any) -> None:
    monkeypatch.setattr(logging.root, 'handlers', [])

    with pytest.raises(SystemExit):
        tomodachi.cli.cli_entrypoint(['tomodachi', 'run', 'tests/services/exception_service_init.py'])

    out, err = capsys.readouterr()
    assert err != ''
    assert 'Starting services' in out
    assert 'tomodachi/{}'.format(tomodachi.__version__) in out
    assert 'fail in __init__()' in err
github kalaspuff / tomodachi / tests / services / aws_sns_sqs_service_with_credentials_with_custom_protocol.py View on Github external
    @aws_sns_sqs('test-custom-topic', message_protocol=CustomProtocol)
    async def test(self, data: Any, protocol: Any, default_value: bool = True) -> None:
        if data == self.data_uuid and protocol == 'custom':
            self.test_topic_data_received = default_value
            self.test_topic_data = data

            self.check_closer()
github kalaspuff / tomodachi / tests / services / aws_sns_sqs_service_with_credentials.py View on Github external
    @aws_sns_sqs('test-topic')
    async def test(self, data: Any, metadata: Any, service: Any) -> None:
        if data == self.data_uuid:
            self.test_topic_data_received = True
            self.test_topic_metadata_topic = metadata.get('topic')
            self.test_topic_service_uuid = service.get('uuid')

            self.check_closer()
github kalaspuff / tomodachi / tests / services / mock_decorator_service.py View on Github external
    @aws_sns_sqs('test-topic')
    async def test(self, default_value: bool = True) -> None:
        self.function_tested = default_value
github kalaspuff / tomodachi / tests / services / aws_sns_sqs_service_invalid_credentials.py View on Github external
    @aws_sns_sqs('test-topic', ('data',))
    async def test(self, data: Any) -> None:
        pass
github kalaspuff / tomodachi / tests / services / aws_sns_sqs_service_with_credentials_without_protocol.py View on Github external
    @aws_sns_sqs('test-raw-topic')
    async def test(self, value: Any, default_value: bool = True) -> None:
        if value == self.data_uuid:
            self.test_topic_data_received = default_value
            self.test_topic_data = value

            self.check_closer()
github kalaspuff / tomodachi / tests / test_watcher.py View on Github external
def test_watcher_auto_root() -> None:
    watcher = Watcher()
    assert watcher.root == [os.path.realpath(sys.argv[0].rsplit('/', 1)[0])]
github kalaspuff / tomodachi / tests / services / amqp_service_with_credentials.py View on Github external
    @amqp('test.topic')
    async def test(self, data: Any, metadata: Any, service: Any) -> None:
        if data == self.data_uuid:
            self.test_topic_data_received = True
            self.test_topic_metadata_topic = metadata.get('topic')
            self.test_topic_service_uuid = service.get('uuid')

            self.check_closer()