Skip to content

Commit

Permalink
Merge pull request #113 from unb-mds/task/codecov
Browse files Browse the repository at this point in the history
tests(codecov): Adicionar arquivos de configuração
  • Loading branch information
caio-felipee authored Nov 27, 2023
2 parents fd53269 + f94dbaf commit 5fac118
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions api/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[coverage:run]
# coverage.py configuration:
# https://coverage.readthedocs.io/en/latest/

# These files can't be tested, so we exclude them from coverage.
# We also exclude the manage.py file, since it's not a part of the app.
omit =
manage.py
users/admin.py
2 changes: 1 addition & 1 deletion api/users/backends/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_user_data(cls, access_token: str) -> dict | None:
return user_data
else:
return None
except requests.exceptions.RequestException as e:
except requests.exceptions.RequestException as e: # pragma: no cover
return None

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion api/utils/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_response(session: Session) -> Response:

"""Obtem o cookie da sessão de requisição necessário para acessar a pagina de turmas
e retorna um cookie jar."""
def get_session_cookie(session: Session) -> cookies.RequestsCookieJar:
def get_session_cookie(session: Session) -> cookies.RequestsCookieJar: # pragma: no cover
response = get_response(session) # Get the response from the request session
cookie = response.cookies.get_dict() # Get the cookie from the response
cookie_jar = cookies.RequestsCookieJar() # Create a cookie jar
Expand Down
6 changes: 3 additions & 3 deletions api/utils/web_scraping.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def __init__(self, department: str, year: str, period: str, url=URL, session=Non
"javax.faces.ViewState": "j_id1"
}

if session is None:
if session is None: # pragma: no cover
self.session = create_request_session() # Create a request session
else:
self.session = session

if cookie is None:
if cookie is None: # pragma: no cover
self.cookie = get_session_cookie(self.session)
else:
self.cookie = cookie
Expand Down Expand Up @@ -106,7 +106,7 @@ def get_teachers(self, data: list) -> list:

teachers.append(content[0].strip())

if len(teachers) == 0:
if len(teachers) == 0: # pragma: no cover
teachers.append("A definir")

return teachers
Expand Down

0 comments on commit 5fac118

Please sign in to comment.