Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
cgoodfred committed Dec 14, 2023
1 parent ebe8fb8 commit 6abeefb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions koku/subs/test/test_subs_data_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ def setUpClass(cls):
"provider_type": cls.aws_provider_type,
"provider_uuid": cls.aws_provider.uuid,
}
azure_context = {
"schema": cls.schema,
"provider_type": cls.azure_provider_type,
"provider_uuid": cls.azure_provider.uuid,
}
with patch("subs.subs_data_extractor.get_s3_resource"):
with patch("subs.subs_data_extractor.SUBSDataExtractor._execute_trino_raw_sql_query"):
cls.extractor = SUBSDataExtractor(cls.tracing_id, context)
cls.azure_extractor = SUBSDataExtractor(cls.tracing_id, azure_context)

def test_subs_s3_path(self):
"""Test that the generated s3 path is expected"""
Expand Down Expand Up @@ -281,3 +287,14 @@ def test_bulk_update_latest_processed_time(self):
)
self.assertEqual(subs_record_1.latest_processed_time, expected_time)
self.assertEqual(subs_record_2.latest_processed_time, expected_time)

def test_provider_creation_time(self):
"""Test provider processing time for different provider types."""
aws_expected = self.aws_provider.created_timestamp.replace(
microsecond=0, second=0, minute=0, hour=0
) - timedelta(days=1)
azure_expected = self.azure_provider.created_timestamp.replace(
microsecond=0, second=0, minute=0, hour=0
) - timedelta(days=2)
self.assertEqual(aws_expected, self.extractor.creation_processing_time)
self.assertEqual(azure_expected, self.azure_extractor.creation_processing_time)

0 comments on commit 6abeefb

Please sign in to comment.