Ejemplo n.º 1
0
def test_return_ok_status_code_on_correct_request_summary():
    url = "https://en.wikipedia.org/api/rest_v1/page/summary/zagreb"
    response = city_info_creator.create_request(url, "summary")
    assert response.status_code == 200
Ejemplo n.º 2
0
def test_return_ok_status_code_on_correct_request_weather():
    url = "http://api.openweathermap.org/data/2.5/weather?q=zagreb&APPID=15bf51e94a29c728f34f933992b31cb2&units=metric"
    response = city_info_creator.create_request(url, "weather")
    assert response.status_code == 200
Ejemplo n.º 3
0
def test_city_summary_request_raises_exception_test():
    url = "https://en.wikipedia.org/api/rest_v1/page/summary/fasdasdds"
    with pytest.raises(NameError):
        city_info_creator.create_request(url, "summary")
Ejemplo n.º 4
0
def test_city_weather_request_raises_exception_test():
    url = "http://api.openweathermap.org/data/2.5/weather?q=asdaasd&APPID=15bf51e94a29c728f34f933992b31cb2&units=metric"
    with pytest.raises(NameError):
        city_info_creator.create_request(url, "weather")
Ejemplo n.º 5
0
def test_city_summary_exception_raised():
    url = "https://en.wikipedia.org/api/rest_v1/page/summary/fasdasdds"
    city_info_creator.create_request(url, "summary")