def print_data(className, searchTerm, res):
    try:
        res = get_data(className, searchTerm, res)
        if not res:
            print('No results found')
        else:
            for p in res:
                print(p)
    except Exception as e:
        print(e)
Exemple #2
0
def test_main():
    json_to_database()
    output = get_data(1, '_id', 71)
    assert output is not None
Exemple #3
0
def test_end():
    clear_database()
    output = get_data(1, '_id', 71)
    assert output == []
Exemple #4
0
def test_different_value_formats():
    assert get_data(1, '_id', 71)
    assert get_data(1, '_id', '71')
Exemple #5
0
def test_invalid_value():
    with pytest.raises(Exception):
        assert get_data(1, '_id', 9999999)
    assert get_data(1, '_id', 9999999) == []
Exemple #6
0
def test_invalid_term():
    with pytest.raises(Exception):
        assert get_data(1, 'INVALID_NAME', 71)
Exemple #7
0
def test_invalid_class_name():
    with pytest.raises(Exception):
        assert get_data(5, '_id', 71)