def METHOD_NAME(self, mock, timeframe, resource_group):
    subscription_id = self.session.get_subscription_id()
    mock.assert_called_once()
    definition = mock.call_args[0][1]
    if isinstance(timeframe, int):
        today = utcnow().replace(hour=0, minute=0, second=0, microsecond=0)
        self.assertEqual(definition.timeframe, 'Custom')
        self.assertEqual(definition.time_period.to, today)
        self.assertEqual(definition.time_period.from_property,
                         today - datetime.timedelta(days=timeframe))
    else:
        self.assertEqual(definition.timeframe, timeframe)
    self.assertEqual(len(definition.dataset.grouping), 1)
    self.assertEqual(definition.dataset.grouping[0].type, 'Dimension')
    self.assertEqual(definition.dataset.grouping[0].name,
                     'ResourceGroupName' if resource_group else 'ResourceId')
    self.assertEqual(definition.dataset.aggregation['totalCost'].name, 'PreTaxCost')
    if not resource_group:
        self.assertEqual(definition.dataset.filter.dimension.name, 'ResourceType')
        self.assertEqual(definition.dataset.filter.dimension.operator, 'In')
        self.assertEqual(definition.dataset.filter.dimension.values,
                         ['Microsoft.Compute/virtualMachines'])
    mock.assert_called_once_with('/subscriptions/' + subscription_id, definition)