Skip to content

Commit

Permalink
Additional test case
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwiklinski-r7 authored and rmurray-r7 committed Jan 21, 2025
1 parent f965541 commit ee5d5a9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions plugins/duo_admin/unit_test/test_monitor_logs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
import os
from time import time

sys.path.append(os.path.abspath("../"))

Expand Down Expand Up @@ -104,3 +105,21 @@ def test_monitor_logs(
self.assertEqual(actual, expected.get("logs"))
self.assertEqual(actual_state, expected.get("state"))
self.assertEqual(status_code, expected.get("status_code"))


def test_monitor_logs_with_rate_limit_whole_flow(self, mock_request, mock_request_instance, mock_get_headers, mock_get_time):
future_time_state = {"rate_limit_datetime": time() + 600}
passed_time_state = {"rate_limit_datetime": time() - 600}

actual, new_state, has_more_pages, status_code, _ = self.task.run(state=future_time_state, custom_config={})

self.assertEqual(actual, [])
self.assertEqual(future_time_state, new_state)
self.assertEqual(has_more_pages, False)
self.assertEqual(status_code, 429)

actual_2, new_state_2, _, status_code_2, _ = self.task.run(state=passed_time_state, custom_config={})

self.assertTrue(actual_2)
self.assertTrue(new_state_2)
self.assertEqual(status_code_2, 200)

0 comments on commit ee5d5a9

Please sign in to comment.