def get_londoners_and_nearby():
    londoners = user_data.get_londoners().json()
    nearby = get_nearby()
    londoner_dict = dict((item["id"], item) for item in londoners)
    nearby_dict = dict((item["id"], item) for item in nearby)
    results = {}
    results.update(londoner_dict)
    results.update(nearby_dict)
    return list(results.values())
def test_get_londoners_and_nearby_contains_all_users_in_get_londoners():
    londoners = user_data.get_londoners()
    combined = fa.get_londoners_and_nearby()
    if (londoners is not None) and (combined is not None):
        londoners = londoners.json()
        londoners_dict = dict((item["id"], item) for item in londoners)
        combined_dict = dict((item["id"], item) for item in combined)
        assert londoners_dict.keys() <= combined_dict.keys()
    else:
        pytest.fail("one of the lists of users is None")
示例#3
0
def test_get_londoners_not_return_none(get_mock_json):
    londoners = user_data.get_londoners()
    assert not londoners is None
示例#4
0
def test_get_londoners_returns_json(get_mock_json):
    londoners = user_data.get_londoners()
    try:
        londoners.json
    except ValueError:
        pytest.fail("output does not contain valid JSON")
示例#5
0
def test_get_londoners_returns_status_ok(get_mock_londoners):
    londoners = user_data.get_londoners()
    assert (londoners.ok)