Skip to content

Commit

Permalink
Fix cm unit test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain-S committed May 16, 2024
1 parent 2d0375e commit 3f27b5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions usage_function/costmanagement/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
from azure.mgmt.costmanagement.models import (
QueryDefinition,
QueryGrouping,
QueryDataset,
TimeframeType,
ExportType,
QueryAggregation,
QueryDataset,
QueryDefinition,
QueryGrouping,
QueryTimePeriod,
TimeframeType,
)

import utils.settings
Expand Down
16 changes: 10 additions & 6 deletions usage_function/tests/test_function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,19 +255,23 @@ def test_get_all_usage(self) -> None:
)
parameters2 = QueryDefinition(
time_period=QueryTimePeriod(
from_property=start_datetime + timedelta(364),
from_property=start_datetime + timedelta(365),
to=end_datetime,
),
dataset=query_dataset,
type=query_type,
timeframe=query_timeframe,
)
scope = "/providers/Microsoft.Management/managementGroups/ea"
mock_list_func.assert_has_calls(
[
call(scope=scope, parameters=parameters1),
call(scope=scope, parameters=parameters2),
]
self.assertEqual(mock_list_func.call_args_list[0].kwargs["scope"], scope)
self.assertEqual(
mock_list_func.call_args_list[0].kwargs["parameters"].serialize(),
parameters1.serialize(),
)
self.assertEqual(mock_list_func.call_args_list[1].kwargs["scope"], scope)
self.assertEqual(
mock_list_func.call_args_list[1].kwargs["parameters"].serialize(),
parameters2.serialize(),
)
self.assertEqual(mock_list_func.call_count, 2)

Expand Down

0 comments on commit 3f27b5d

Please sign in to comment.