Ejemplo n.º 1
0
def test_process_event(datadir):
    apigw_event = json.loads(open(datadir.join('apigw_event.json'), 'rt').read())

    event = Event()
    event.parse_event(apigw_event)

    assert event.event == apigw_event
    assert event.method == 'POST'
    assert event.body['data_stuff'] == 'down is the new up'
    assert event.params['foo'] == 'bar'
    assert event.path == '/the/cool/path'
Ejemplo n.º 2
0
def test_process_event_fail(datadir):
    apigw_event = json.loads(open(datadir.join('apigw_event_err.json'), 'rt').read())

    event = Event()
    with pytest.raises(Exception):
        event.parse_event(apigw_event)