Skip to content

Commit

Permalink
unit coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lcouzens committed Jun 27, 2024
1 parent 0abfa4f commit 7356d7f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions koku/masu/test/processor/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import random
from datetime import date
from datetime import datetime
from datetime import timedelta
from types import SimpleNamespace
from unittest.mock import patch
from uuid import uuid4

Expand Down Expand Up @@ -545,6 +547,22 @@ def test_get_billing_month_start(self):

def test_check_currently_processing(self):
"""Test to check if we should poll a provider that may have tasks in progress."""
now = self.dh.now_utc
# Check we would process if not processed before
result = check_currently_processing(self.schema_name, self.ocp_provider)
self.assertEqual(result, False)
# Check we have task processing, no polling
one_days_ago = now - timedelta(days=1)
two_days_ago = now - timedelta(days=2)
provider_processing = SimpleNamespace()
provider_processing.polling_timestamp = one_days_ago
provider_processing.data_updated_timestamp = two_days_ago
result = check_currently_processing(self.schema_name, provider_processing)
self.assertEqual(result, True)
# Check we have task processing but likely failed, needs repolling
seven_days_ago = now - timedelta(days=7)
provider_failed = SimpleNamespace()
provider_failed.polling_timestamp = two_days_ago
provider_failed.data_updated_timestamp = seven_days_ago
result = check_currently_processing(self.schema_name, provider_failed)
self.assertEqual(result, False)

0 comments on commit 7356d7f

Please sign in to comment.