Skip to content

Commit

Permalink
Putting nosec to ignore Bandit security warning on unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sylviamclaughlin authored Apr 27, 2024
1 parent ad252a1 commit bd47338
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/tests/integrations/google_workspace/test_google_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ def test_get_federal_holidays(requests_mock):
{"observedDate": "2024-12-25"},
]
}
requests_mock.get(
# Bandit skip security check for the requests_mock.get call
requests_mock.get( # nosec
"https://canada-holidays.ca/api/v1/holidays?federal=true&year=2024",
json=mocked_response,
)
Expand All @@ -518,7 +519,8 @@ def test_get_federal_holidays_with_different_year(requests_mock):
# set the timeout to 10s
requests_mock.DEFAULT_TIMEOUT = 10
# Mock the API response for a different year
requests_mock.get(
# Bandit skip security check for the requests_mock.get call
requests_mock.get( # nosec
"https://canada-holidays.ca/api/v1/holidays?federal=true&year=2025",
json={"holidays": []},
)
Expand All @@ -541,7 +543,8 @@ def test_api_returns_empty_list(requests_mock):
# set the timeout to 10s
requests_mock.DEFAULT_TIMEOUT = 10
# Mock no holidays
requests_mock.get(
# Bandit skip security check for the requests_mock.get call
requests_mock.get( # nosec
"https://canada-holidays.ca/api/v1/holidays?federal=true&year=2024",
json={"holidays": []},
)
Expand All @@ -558,7 +561,8 @@ def test_leap_year_handling(requests_mock):
# set the timeout to 10s
requests_mock.DEFAULT_TIMEOUT = 10
# Mock response for a leap year with an extra day
requests_mock.get(
# Bandit skip security check for the requests_mock.get call
requests_mock.get( # nosec
"https://canada-holidays.ca/api/v1/holidays?federal=true&year=2024",
json={
"holidays": [
Expand Down

0 comments on commit bd47338

Please sign in to comment.