示例#1
0
def test_set_body_encoded(datadir):
    apigw_event = json.loads(open(datadir.join('apigw_event.json'), 'rt').read())
    event = Event()
    event.set_event(apigw_event)
    event.set_body()
    print(event.body)
    assert event.body['data_stuff'] == "down is the new up"
示例#2
0
def test_set_body_no_event():
    event = Event()
    with pytest.raises(AwAwsMissingRequirement,
                       match=r'use event.set_event()'
                       ):
        event.set_body()
示例#3
0
def test_set_body_no_body(datadir):
    apigw_event = json.loads(open(datadir.join('apigw_event_3.json'), 'rt').read())
    event = Event()
    event.set_event(apigw_event)
    event.set_body()
    assert event.body is None
示例#4
0
def test_set_body_dencoded_error(datadir):
    apigw_event = json.loads(open(datadir.join('apigw_event_4.json'), 'rt').read())
    event = Event()
    event.set_event(apigw_event)
    with pytest.raises(Exception, match=r'Error decoding'):
        event.set_body()