Skip to content

Commit

Permalink
Lint roll
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorntonMatthewD authored and oliviasculley committed Oct 2, 2023
1 parent 3e6bc53 commit b858e39
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ async def check_api_on_cooldown(team_domain: Union[str, None]) -> bool:
if expiry is None:
return False

if datetime.datetime.now(datetime.timezone.utc) > datetime.datetime.fromisoformat(expiry):
if datetime.datetime.now(datetime.timezone.utc) > datetime.datetime.fromisoformat(
expiry
):
return False

return True
Expand Down
2 changes: 2 additions & 0 deletions tests/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ def create_slack_request_payload(
)

return bytes(sample_payload, "utf-8")


# pylint: enable=too-many-arguments
14 changes: 8 additions & 6 deletions tests/test_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def test_health_check_healthy_threads(test_client):
assert response.content == b'{"detail":"Everything is lookin\' good!"}'



def test_health_check_with_a_dead_thread(test_client, threads_appear_dead): # pylint: disable=unused-argument
def test_health_check_with_a_dead_thread(
test_client, threads_appear_dead
): # pylint: disable=unused-argument
"""Tests what happens if a dead thread is found whenever this endpoint is hit."""
response = test_client.get("healthz")

Expand All @@ -37,7 +38,9 @@ def test_health_check_with_a_dead_thread(test_client, threads_appear_dead): # py
)


def test_check_api_whenever_someone_executes_it_for_first_time(test_client, db_cleanup): # pylint: disable=unused-argument
def test_check_api_whenever_someone_executes_it_for_first_time(
test_client, db_cleanup
): # pylint: disable=unused-argument
"""Whenever an entity executes /check_api for the first time it should run successfully."""
response = test_client.post(
"/slack/events",
Expand All @@ -57,7 +60,7 @@ def test_check_api_whenever_someone_executes_it_for_first_time(test_client, db_c

@pytest.mark.asyncio
async def test_check_api_whenever_someone_executes_it_after_expiry(
test_client, db_cleanup
test_client, db_cleanup # pylint: disable=unused-argument
):
"""
Whenever an entity has run /check_api before, and their cooldown window has expired,
Expand All @@ -80,7 +83,7 @@ async def test_check_api_whenever_someone_executes_it_after_expiry(

@pytest.mark.asyncio
async def test_check_api_whenever_someone_executes_it_before_expiry(
test_client, db_cleanup # pylint: disable=unused-argument
test_client, db_cleanup # pylint: disable=unused-argument
):
"""
Whenever an entity has run /check_api before, and their cooldown window has NOT expired,
Expand All @@ -96,4 +99,3 @@ async def test_check_api_whenever_someone_executes_it_before_expiry(
)
assert response.status_code == 200
assert response.content.decode("utf-8") == RATE_LIMIT_COPY

0 comments on commit b858e39

Please sign in to comment.