|
32 | 32 | from reporting.provider.all.models import EnabledTagKeys
|
33 | 33 | from reporting.provider.aws.models import AWSCostEntryBill
|
34 | 34 | from reporting.provider.aws.models import AWSCostEntryLineItemDailySummary
|
35 |
| -from reporting.provider.aws.models import AWSTagsSummary |
36 | 35 |
|
37 | 36 |
|
38 | 37 | class AWSReportDBAccessorTest(MasuTestCase):
|
@@ -229,50 +228,6 @@ def test_populate_ocp_on_aws_cost_daily_summary_trino_memory_distribution(
|
229 | 228 | )
|
230 | 229 | mock_trino.assert_called()
|
231 | 230 |
|
232 |
| - def test_populate_enabled_tag_keys(self): |
233 |
| - """Test that enabled tag keys are populated.""" |
234 |
| - start_date = self.dh.this_month_start.date() |
235 |
| - end_date = self.dh.this_month_end.date() |
236 |
| - |
237 |
| - bills = self.accessor.bills_for_provider_uuid(self.aws_provider_uuid, start_date) |
238 |
| - with schema_context(self.schema): |
239 |
| - AWSTagsSummary.objects.all().delete() |
240 |
| - EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_AWS).delete() |
241 |
| - |
242 |
| - bill_ids = [bill.id for bill in bills] |
243 |
| - self.assertEqual(EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_AWS).count(), 0) |
244 |
| - self.accessor.populate_enabled_tag_keys(start_date, end_date, bill_ids) |
245 |
| - self.assertNotEqual(EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_AWS).count(), 0) |
246 |
| - |
247 |
| - def test_update_line_item_daily_summary_with_enabled_tags(self): |
248 |
| - """Test that we filter the daily summary table's tags with only enabled tags.""" |
249 |
| - start_date = self.dh.this_month_start.date() |
250 |
| - end_date = self.dh.this_month_end.date() |
251 |
| - |
252 |
| - bills = self.accessor.bills_for_provider_uuid(self.aws_provider_uuid, start_date) |
253 |
| - with schema_context(self.schema): |
254 |
| - AWSTagsSummary.objects.all().delete() |
255 |
| - key_to_keep = EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_AWS).filter(key="app").first() |
256 |
| - EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_AWS).update(enabled=False) |
257 |
| - EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_AWS).filter(key="app").update(enabled=True) |
258 |
| - bill_ids = [bill.id for bill in bills] |
259 |
| - self.accessor.update_line_item_daily_summary_with_enabled_tags(start_date, end_date, bill_ids) |
260 |
| - tags = ( |
261 |
| - AWSCostEntryLineItemDailySummary.objects.filter( |
262 |
| - usage_start__gte=start_date, cost_entry_bill_id__in=bill_ids |
263 |
| - ) |
264 |
| - .values_list("tags") |
265 |
| - .distinct() |
266 |
| - ) |
267 |
| - |
268 |
| - for tag in tags: |
269 |
| - tag_dict = tag[0] |
270 |
| - tag_keys = list(tag_dict.keys()) |
271 |
| - if tag_keys: |
272 |
| - self.assertEqual([key_to_keep.key], tag_keys) |
273 |
| - else: |
274 |
| - self.assertEqual([], tag_keys) |
275 |
| - |
276 | 231 | def test_table_properties(self):
|
277 | 232 | self.assertEqual(self.accessor.line_item_daily_summary_table, get_model("AWSCostEntryLineItemDailySummary"))
|
278 | 233 |
|
|
0 commit comments