def test_checkin(requests_mock):
    requests_mock.register_uri(
        'GET',
        '/api/mobile-misc/v1/mobile-misc/page/view-reservation/XXXX?first-name=John&last-name=Smith',
        text=template_time('fixtures/view-reservation.json'))
    requests_mock.register_uri(
        'GET',
        '/api/mobile-air-operations/v1/mobile-air-operations/page/check-in/XXXX?first-name=John&last-name=Smith',
        text=template_time('fixtures/checkin-get.json'))
    requests_mock.register_uri(
        'POST',
        '/api/mobile-air-operations/v1/mobile-air-operations/page/check-in',
        text=template_time('fixtures/checkin-post.json'))
    requests_mock.register_uri('POST',
                               '/php/apsearch.php',
                               text=template_time('fixtures/openflights.json'))
    try:
        checkin.auto_checkin('XXXX', 'John', 'Smith', None, None)
    except:
        pytest.fail("Error checking in")
def test_checkin(m):
    m.register_uri(
        'GET',
        '/api/mobile-misc/v1/mobile-misc/page/view-reservation/XXXX?first-name=John&last-name=Smith',
        text=open('fixtures/view-reservation.json', 'r').read())
    m.register_uri(
        'GET',
        '/api/mobile-air-operations/v1/mobile-air-operations/page/check-in/XXXX?first-name=John&last-name=Smith',
        text=open('fixtures/checkin-get.json', 'r').read())
    m.register_uri(
        'POST',
        '/api/mobile-air-operations/v1/mobile-air-operations/page/check-in',
        text=open('fixtures/checkin-post.json', 'r').read())
    assert checkin.auto_checkin('XXXX', 'John', 'Smith') == None
Esempio n. 3
0
def test_checkin(requests_mock):
    requests_mock.register_uri(
        'GET',
        '/api/mobile-misc/v1/mobile-misc/page/view-reservation/XXXX?first-name=John&last-name=Smith',
        text=open('fixtures/view-reservation.json', 'r').read())
    requests_mock.register_uri(
        'GET',
        '/api/mobile-air-operations/v1/mobile-air-operations/page/check-in/XXXX?first-name=John&last-name=Smith',
        text=open('fixtures/checkin-get.json', 'r').read())
    requests_mock.register_uri(
        'POST',
        '/api/mobile-air-operations/v1/mobile-air-operations/page/check-in',
        text=open('fixtures/checkin-post.json', 'r').read())
    requests_mock.register_uri('POST',
                               '/php/apsearch.php',
                               text=open('fixtures/openflights.json',
                                         'r').read())
    assert checkin.auto_checkin('XXXX', 'John', 'Smith') == None
def test_cli():
    try:
        checkin.auto_checkin('XXXXXX', 'John', 'Smith')
    except Exception:
        pytest.fail("cli error")