def test_select_random_restaurant_selects_random_number_between_0_and_length_of_array():
   with app.app_context():
       example_restaurants = ["Lona's", "Mac's", "Mochi"]

       selection = select_random_restaurant(example_restaurants)
       print(selection)

       assert example_restaurants.index(selection) == 0 or example_restaurants.index(selection) < len(example_restaurants) + 1
def test_organize_restaurant_output_returns_expected_keys():
    with app.app_context():
        expected_keys = ["id", "name", "neighborhood", "cuisine", "address", "website"]
        result = organize_restaurant_output()[0]

        result_keys = []
        for key in result.keys(): 
            result_keys.append(key)
            
        assert result_keys == expected_keys
Пример #3
0
def test_get_all_restaurants_returns_status_code_200():
    with app.app_context():
        result = get_all_restaurants()

        assert result.status_code
Пример #4
0
def test_get_restaurant_recommendation_returns_one_restaurant():
    with app.app_context():
        result = get_restaurant_recommendation().json["result"]

        assert len(result) == 6
Пример #5
0
def test_get_restaurant_recommendation_returns_status_code_200():
    with app.app_context():
        result = get_restaurant_recommendation()

        assert result.status_code
Пример #6
0
def test_get_all_restaurants_returns_all_restaurants():
    with app.app_context():
        document_count = restaurants.count()
        result = get_all_restaurants().json["result"]

        assert document_count == len(result)