Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed university apis and added E2E tests #343

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _sources/lectures/TWP45/TWP45_4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contiene dominios, nombres y países de la mayoría de las universidades del mu
import urllib.parse
import json

api_url = "https://cors.bridged.cc/http://universities.hipolabs.com/search?"
api_url = "http://universities.hipolabs.com/search?"
parametros = urllib.parse.urlencode({"name": "middle", "country": "turkey"})

solicitud = urllib.request.urlopen(api_url + parametros)
Expand All @@ -35,7 +35,7 @@ contiene dominios, nombres y países de la mayoría de las universidades del mu
import requests
import json

api_url = "https://cors.bridged.cc/http://universities.hipolabs.com/search"
api_url = "http://universities.hipolabs.com/search"
parametros = {"country": "colombia"}

solicitud = requests.get(api_url, params=parametros)
Expand Down
4 changes: 2 additions & 2 deletions _sources/lectures/TWP45/TWP45_4_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ domains, names, and countries of most universities around the world.
import urllib.parse
import json

api_url = "https://cors.bridged.cc/http://universities.hipolabs.com/search?"
api_url = "http://universities.hipolabs.com/search?"
params = urllib.parse.urlencode({"name": "middle", "country": "turkey"})

request = urllib.request.urlopen(api_url + params)
Expand All @@ -35,7 +35,7 @@ domains, names, and countries of most universities around the world.
import requests
import json

api_url = "https://cors.bridged.cc/http://universities.hipolabs.com/search"
api_url = "http://universities.hipolabs.com/search"
params = {"country": "colombia"}

request = requests.get(api_url, params=params)
Expand Down
25 changes: 25 additions & 0 deletions tests/test_TWP45.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,28 @@ def test_l45_3_en(page):
page.hover("#ac_l45_3c_en >> text=You passed:")
assert page.inner_text(
"#ac_l45_3c_en >> text=You passed:") == "You passed: 100.0% of the tests"


def test_l45_4_api_1():
"""Tests fetching data from the provided URL"""
# Send a GET request to the URL for a sample user
url = "http://universities.hipolabs.com/search?name=middle&country=turkey"

# Send a GET request to the URL
response = requests.get(url)

# Check for successful response (status code 200)
assert response.status_code == 200, f"Expected status code 200, but got {response.status_code}, Data can not be fetched from the provided URL"


def test_l45_4_api_2():
"""Tests fetching data from the provided URL"""
# Send a GET request to the URL for a sample user
url = "http://universities.hipolabs.com/search?country=colombia"

# Send a GET request to the URL
response = requests.get(url)

# Check for successful response (status code 200)
assert response.status_code == 200, f"Expected status code 200, but got {response.status_code}, Data can not be fetched from the provided URL"

Loading