Пример #1
0
def test_get_context_order_create():
    context = get_context('routing-keys/order-service.auto.order.created.json')
    assert type(context) is CreateOrderContext
Пример #2
0
def test_get_context_bad_action():
    with pytest.raises(KeyError):
        get_context('routing-keys/order-service.auto.order.creatd.json')

    with pytest.raises(KeyError):
        get_context('routing-keys/policy-service.auto.order.ac.json')
Пример #3
0
def test_get_context_bad_service():
    with pytest.raises(KeyError):
        get_context('routing-keys/a.auto.order.created.json')
Пример #4
0
def test_get_context_policy_refuse():
    context = get_context('routing-keys/policy-service.auto.policy.refused.json')
    assert type(context) is UpdatePolicyContext
Пример #5
0
def test_get_context_policy_create():
    context = get_context('routing-keys/policy-service.auto.policy.created.json')
    assert type(context) is CreatePolicyContext
Пример #6
0
from argparse import ArgumentParser

from Context import get_context

if __name__ == '__main__':
    parser = ArgumentParser(description='Process events')
    parser.add_argument('file_path', type=str)
    file_path = parser.parse_args().file_path

    context = get_context(file_path)
    context.process()