diff --git a/nise/__init__.py b/nise/__init__.py index 511a7465..ea060b08 100644 --- a/nise/__init__.py +++ b/nise/__init__.py @@ -1,3 +1,3 @@ -__version__ = "4.5.7" +__version__ = "4.6.0" VERSION = __version__.split(".") diff --git a/nise/__main__.py b/nise/__main__.py index 046c1776..45e13a10 100644 --- a/nise/__main__.py +++ b/nise/__main__.py @@ -196,12 +196,12 @@ def add_azure_parser_args(parser): help="Azure container to place the data.", ) parser.add_argument( - "-v2", - "--version-two", - dest="version_two", + "-rg", + "--resource-group", + dest="resource_group", action="store_true", required=False, - help="Generate version two of the azure report.", + help="Generate resource group based azure report.", ) diff --git a/nise/generators/azure/__init__.py b/nise/generators/azure/__init__.py index 8ca6cbf0..f92a5862 100644 --- a/nise/generators/azure/__init__.py +++ b/nise/generators/azure/__init__.py @@ -15,14 +15,14 @@ # along with this program. If not, see . # """Module for azure data generators.""" -from nise.generators.azure.azure_generator import AZURE_COLUMNS # noqa: F401 -from nise.generators.azure.azure_generator import AZURE_COLUMNS_V2 # noqa: F401 -from nise.generators.azure.azure_generator import AzureGenerator # noqa: F401 -from nise.generators.azure.bandwidth_generator import BandwidthGenerator # noqa: F401 -from nise.generators.azure.ccsp_generator import CCSPGenerator # noqa: F401 -from nise.generators.azure.data_transfer_generator import DTGenerator # noqa: F401 -from nise.generators.azure.managed_disk_generator import ManagedDiskGenerator # noqa: F401 -from nise.generators.azure.sql_database_generator import SQLGenerator # noqa: F401 -from nise.generators.azure.storage_generator import StorageGenerator # noqa: F401 -from nise.generators.azure.virtual_machine_generator import VMGenerator # noqa: F401 -from nise.generators.azure.virtual_network_generator import VNGenerator # noqa: F401 +from nise.generators.azure.azure_generator import AZURE_COLUMNS_V2_RESOURCE_GROUP +from nise.generators.azure.azure_generator import AZURE_COLUMNS_V2_SUBSCRIPTION +from nise.generators.azure.azure_generator import AzureGenerator +from nise.generators.azure.bandwidth_generator import BandwidthGenerator +from nise.generators.azure.ccsp_generator import CCSPGenerator +from nise.generators.azure.data_transfer_generator import DTGenerator +from nise.generators.azure.managed_disk_generator import ManagedDiskGenerator +from nise.generators.azure.sql_database_generator import SQLGenerator +from nise.generators.azure.storage_generator import StorageGenerator +from nise.generators.azure.virtual_machine_generator import VMGenerator +from nise.generators.azure.virtual_network_generator import VNGenerator diff --git a/nise/generators/azure/azure_generator.py b/nise/generators/azure/azure_generator.py index 3637d1b8..6fd2088e 100644 --- a/nise/generators/azure/azure_generator.py +++ b/nise/generators/azure/azure_generator.py @@ -25,43 +25,88 @@ from nise.generators.generator import AbstractGenerator -AZURE_COLUMNS = ( - "SubscriptionGuid", - "ResourceGroup", +AZURE_COLUMNS_V2_SUBSCRIPTION = ( + "InvoiceSectionName", + "AccountName", + "AccountOwnerId", + "SubscriptionId", + "SubscriptionName", + "ResourceGroupName", "ResourceLocation", - "UsageDateTime", + "Date", + "ProductName", "MeterCategory", - "MeterSubcategory", + "MeterSubCategory", "MeterId", "MeterName", "MeterRegion", - "UsageQuantity", - "ResourceRate", - "PreTaxCost", + "UnitOfMeasure", + "Quantity", + "EffectivePrice", + "CostInBillingCurrency", + "CostCenter", "ConsumedService", - "ResourceType", - "InstanceId", + "ResourceId", "Tags", "OfferId", "AdditionalInfo", "ServiceInfo1", "ServiceInfo2", - "ServiceName", - "ServiceTier", - "Currency", - "UnitOfMeasure", + "ResourceName", + "ReservationId", + "ReservationName", + "UnitPrice", + "ProductOrderId", + "ProductOrderName", + "Term", + "PublisherType", + "PublisherName", + "ChargeType", + "Frequency", + "PricingModel", + "AvailabilityZone", + "BillingAccountId", + "BillingCurrency", + "BillingAccountName", + "BillingPeriodStartDate", + "BillingPeriodEndDate", + "BillingProfileId", + "BillingProfileName", + "InstanceName", + "InvoiceSectionId", + "IsAzureCreditEligible", + "PartNumber", + "PayGPrice", + "PlanName", + "ServiceFamily", + "invoiceId", + "previousInvoiceId", + "resellerName", + "resellerMpnId", + "servicePeriodEndDate", + "servicePeriodStartDate", + "Product", + "ProductId", + "publisherId", + "Location", + "pricingCurrency", + "costInPricingCurrency", + "costInUsd", + "paygCostInBillingCurrency", + "paygCostInUsd", + "exchangeRatePricingToBilling", + "exchangeRateDate", ) -AZURE_COLUMNS_V2 = ( +AZURE_COLUMNS_V2_RESOURCE_GROUP = ( "InvoiceSectionName", "AccountName", "AccountOwnerId", - "SubscriptionId", + "SubscriptionGuid", "SubscriptionName", "ResourceGroup", "ResourceLocation", "Date", - "ProductName", "MeterCategory", "MeterSubCategory", "MeterId", @@ -73,7 +118,6 @@ "CostInBillingCurrency", "CostCenter", "ConsumedService", - "ResourceId", "Tags", "OfferId", "AdditionalInfo", @@ -93,16 +137,17 @@ "PricingModel", "AvailabilityZone", "BillingAccountId", - "BillingAccountName", "BillingCurrencyCode", + "BillingAccountName", "BillingPeriodStartDate", "BillingPeriodEndDate", "BillingProfileId", "BillingProfileName", + "InstanceName", "InvoiceSectionId", "IsAzureCreditEligible", "PartNumber", - "PayGPrice", + "MarketPrice", "PlanName", "ServiceFamily", "invoiceId", @@ -111,15 +156,16 @@ "resellerMpnId", "servicePeriodEndDate", "servicePeriodStartDate", + "Product", "ProductId", "publisherId", "Location", - "pricingCurrency", + "pricingCurrencyCode", "costInPricingCurrency", "costInUsd", "paygCostInBillingCurrency", "paygCostInUsd", - "exchangeRatePricingToBilling", + "exchangeRate", "exchangeRateDate", ) @@ -181,7 +227,7 @@ def meter_name(self): def __init__(self, start_date, end_date, currency, account_info, attributes=None): # noqa: C901 """Initialize the generator.""" - self.azure_columns = AZURE_COLUMNS + self.azure_columns = AZURE_COLUMNS_V2_SUBSCRIPTION self.subscription_guid = account_info.get("subscription_guid") self.account_info = account_info self.usage_accounts = account_info.get("usage_accounts") @@ -202,7 +248,6 @@ def __init__(self, start_date, end_date, currency, account_info, attributes=None self._billing_currency = currency self._additional_info = None self._data_direction = None - # Version 2 fields self._invoice_section_id = None self._invoice_section_name = None @@ -210,8 +255,8 @@ def __init__(self, start_date, end_date, currency, account_info, attributes=None for key, value in attributes.items(): attr_name = "_" + key setattr(self, attr_name, value) - if attributes.get("version_two"): - self.azure_columns = AZURE_COLUMNS_V2 + if attributes.get("resource_group"): + self.azure_columns = AZURE_COLUMNS_V2_RESOURCE_GROUP super().__init__(start_date, end_date) @staticmethod @@ -268,6 +313,9 @@ def _get_resource_info(self, meter_id, service_meter, ex_resource, service_info) service_info_2, ) + def _add_common_usage_info(self, row, start, end, **kwargs): + """Not needed for Azure.""" + def _get_location_info(self): """Get bandwidth info.""" azure_region, meter_region = self._get_location() @@ -314,26 +362,6 @@ def _get_additional_info(self, meter_name=None): else: return choice(self.ADDITIONAL_INFO) - def _add_common_usage_info(self, row, start, end, **kwargs): - """Add common usage information.""" - if self.azure_columns == AZURE_COLUMNS_V2: - usage_account = choice(self.usage_accounts) - row["SubscriptionId"] = self.subscription_guid - row["SubscriptionName"] = self.account_info.get("subscription_name") - row["AccountName"] = usage_account[0] - row["AccountOwnerId"] = usage_account[1] - row["BillingAccountId"] = self.account_info.get("billing_account_id") - row["BillingAccountName"] = self.account_info.get("billing_account_name") - row["BillingProfileId"] = self.account_info.get("billing_account_id") - row["BillingProfileName"] = self.account_info.get("billing_account_name") - row["Date"] = start.date().strftime(DATE_FMT) - row["BillingPeriodStartDate"] = self.first_day_of_month(start).strftime(DATE_FMT) - row["BillingPeriodEndDate"] = self.last_day_of_month(start).strftime(DATE_FMT) - else: - row["SubscriptionGuid"] = self.subscription_guid - row["UsageDateTime"] = start.strftime(DATE_FMT) - return row - def _add_tag_data(self, row): """Add tag dictionary data options to the row.""" if not self._tags: @@ -344,8 +372,6 @@ def _add_tag_data(self, row): def _update_data(self, row, start, end, **kwargs): """Update data with generator specific data.""" - row = self._add_common_usage_info(row, start, end) - meter_id = self._meter_id if self._meter_id else self.fake.uuid4() rate = self._resource_rate if self._resource_rate else round(uniform(0.1, 0.50), 5) amount = self._usage_quantity if self._usage_quantity else uniform(0.01, 1) @@ -366,7 +392,18 @@ def _update_data(self, row, start, end, **kwargs): if not service_info_2: service_info_2 = "" - row["ResourceGroup"] = resource_group + if self.usage_accounts: + usage_account = choice(self.usage_accounts) + row["AccountName"] = usage_account[0] + row["AccountOwnerId"] = usage_account[1] + row["SubscriptionName"] = self.account_info.get("subscription_name") + row["BillingAccountId"] = self.account_info.get("billing_account_id") + row["BillingAccountName"] = self.account_info.get("billing_account_name") + row["BillingProfileId"] = self.account_info.get("billing_account_id") + row["BillingProfileName"] = self.account_info.get("billing_account_name") + row["Date"] = start.date().strftime(DATE_FMT) + row["BillingPeriodStartDate"] = self.first_day_of_month(start).strftime(DATE_FMT) + row["BillingPeriodEndDate"] = self.last_day_of_month(start).strftime(DATE_FMT) row["ResourceLocation"] = azure_region row["MeterCategory"] = self._service_name row["MeterId"] = str(self.meter_id) @@ -381,22 +418,21 @@ def _update_data(self, row, start, end, **kwargs): row = self._map_header_to_report_version( row, meter_sub, str(amount), str(rate), str(cost), instance_id, service_tier ) - if self.azure_columns == AZURE_COLUMNS_V2: - row = self.add_v2_specific_columns(row, instance_id=instance_id) - self._add_tag_data(row) - return row - - def add_v2_specific_columns(self, row, **kwargs): - """Add values for columns specific to the V2 report.""" + if self.azure_columns is AZURE_COLUMNS_V2_SUBSCRIPTION: + row["SubscriptionId"] = self.subscription_guid + row["ResourceGroupName"] = resource_group + row["ProductName"] = "" + row["PayGPrice"] = 0 + else: + row["SubscriptionGuid"] = self.subscription_guid + row["ResourceGroup"] = resource_group + row["MarketPrice"] = 0 resource_name = "" if kwargs.get("instance_id"): resource_name = kwargs.get("instance_id").split("/") resource_name = resource_name[len(resource_name) - 1] - - # NOTE: Commented out columns exist in the report, but we don't have enough - # information to date to accurately simulate values. if self._service_name == "Virtual Machines": if getattr(self, "_CCSP", False): publisher_name = "Microsoft" @@ -415,14 +451,16 @@ def add_v2_specific_columns(self, row, **kwargs): row["InvoiceSectionName"] = ( self._invoice_section_name if self._invoice_section_id else choice(self.INVOICE_SECTION_NAMES) ) - row["ProductName"] = "" + + # NOTE: Commented out columns exist in the report, but we don't have enough + # information to date to accurately simulate values. row["ResourceName"] = resource_name row["IsAzureCreditEligible"] = "TRUE" row["ServiceFamily"] = service_family row["Frequency"] = "UsageBased" row["PublisherType"] = publisher_type row["ChargeType"] = "Usage" - row["PayGPrice"] = 0 + row["PublisherName"] = publisher_name # row['PricingModel'] = # row['ReservationId'] = # row['ReservationName'] = @@ -430,35 +468,49 @@ def add_v2_specific_columns(self, row, **kwargs): # row['ProductOrderName'] = # row['AvailabilityZone'] = # row['Term'] = - row["PublisherName"] = publisher_name # row['PlanName'] = # row['PartNumber'] = # row['CostCenter'] = + # row['previousInvoiceId'] = + # row['resellerName'] = + # row['resellerMpnId'] = + # row['servicePeriodEndDate'] = + # row['servicePeriodStartDate'] = + # row['Product'] = + # row['ProductId'] = + # row['publisherId'] = + # row['Location'] = + # row['pricingCurrencyCode'] = + # row['costInPricingCurrency'] = + # row['costInUsd'] = + # row['paygCostInBillingCurrency'] = + # row['paygCostInUsd'] = + # row['exchangeRate'] = + # row['exchangeRateDate'] = + # row['offerid'] = + # row['serviceinfo1'] = + # row['instancename'] = + # row['invoiceId'] = if hasattr(self, "_product_id"): row["ProductId"] = self._product_id + self._add_tag_data(row) + return row def _map_header_to_report_version(self, row, meter_sub, amount, rate, cost, instance_id, service_tier): - if self.azure_columns == AZURE_COLUMNS_V2: - row["MeterSubCategory"] = meter_sub - row["Quantity"] = amount - row["EffectivePrice"] = rate - row["UnitPrice"] = rate - row["CostInBillingCurrency"] = cost + row["Quantity"] = amount + row["MeterSubCategory"] = meter_sub + row["EffectivePrice"] = rate + row["UnitPrice"] = rate + row["CostInBillingCurrency"] = cost + + if self.azure_columns is AZURE_COLUMNS_V2_SUBSCRIPTION: row["ResourceId"] = instance_id - row["BillingCurrencyCode"] = self._billing_currency + row["BillingCurrency"] = self._billing_currency else: - row["MeterSubcategory"] = meter_sub - row["UsageQuantity"] = amount - row["ResourceRate"] = rate - row["PreTaxCost"] = cost - row["InstanceId"] = instance_id - row["Currency"] = self._billing_currency - # Version one specific - row["ResourceType"] = self._resource_type - row["ServiceName"] = self._service_name - row["ServiceTier"] = service_tier + row["BillingCurrencyCode"] = self._billing_currency + return row def _generate_hourly_data(self, **kwargs): diff --git a/nise/report.py b/nise/report.py index 6cfb901a..c48f5ebd 100644 --- a/nise/report.py +++ b/nise/report.py @@ -768,7 +768,6 @@ def azure_create_report(options): # noqa: C901 storage_account_name = options.get("azure_account_name") azure_prefix_name = options.get("azure_prefix_name") azure_report_name = options.get("azure_report_name") - version_two = options.get("version_two", False) write_monthly = options.get("write_monthly", False) for month in months: data = [] @@ -795,7 +794,6 @@ def azure_create_report(options): # noqa: C901 if attributes.get("meter_cache"): meter_cache.update(attributes.get("meter_cache")) # needed so that meter_cache can be defined in yaml attributes["meter_cache"] = meter_cache - attributes["version_two"] = version_two gen = generator_cls(gen_start_date, gen_end_date, currency, account_info, attributes) azure_columns = gen.azure_columns data += gen.generate_data() diff --git a/tests/test_azure_generator.py b/tests/test_azure_generator.py index e7e0a261..4da2b9d5 100644 --- a/tests/test_azure_generator.py +++ b/tests/test_azure_generator.py @@ -20,8 +20,8 @@ from unittest import TestCase from faker import Faker -from nise.generators.azure import AZURE_COLUMNS -from nise.generators.azure import AZURE_COLUMNS_V2 +from nise.generators.azure import AZURE_COLUMNS_V2_RESOURCE_GROUP +from nise.generators.azure import AZURE_COLUMNS_V2_SUBSCRIPTION from nise.generators.azure import AzureGenerator from nise.generators.azure import BandwidthGenerator from nise.generators.azure import DTGenerator @@ -58,7 +58,7 @@ def setUp(self): self.one_hour = timedelta(minutes=60) self.account_info = _generate_azure_account_info() self.payer_account = self.account_info.get("subscription_guid") - self.version_two_attribute = {"version_two": True} + self.resource_group_attribute = {"resource_group": True} self.currency = "USD" def test_set_hours_invalid_start(self): @@ -92,7 +92,7 @@ def test_set_hours(self): two_hours_ago = (self.now - self.one_hour) - self.one_hour generators = [ TestGenerator(two_hours_ago, self.now, self.currency, self.account_info), - TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.version_two_attribute), + TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.resource_group_attribute), ] expected = [ {"start": two_hours_ago, "end": two_hours_ago + self.one_hour}, @@ -106,11 +106,11 @@ def test_init_data_row(self): two_hours_ago = (self.now - self.one_hour) - self.one_hour generators = [ TestGenerator(two_hours_ago, self.now, self.currency, self.account_info), - TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.version_two_attribute), + TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.resource_group_attribute), ] for generator in generators: columns = generator.azure_columns - self.assertIn(columns, [AZURE_COLUMNS, AZURE_COLUMNS_V2]) + self.assertIn(columns, [AZURE_COLUMNS_V2_SUBSCRIPTION, AZURE_COLUMNS_V2_RESOURCE_GROUP]) a_row = generator._init_data_row(two_hours_ago, self.now) self.assertIsInstance(a_row, dict) for col in columns: @@ -121,7 +121,7 @@ def test_init_data_row_start_none(self): two_hours_ago = (self.now - self.one_hour) - self.one_hour generators = [ TestGenerator(two_hours_ago, self.now, self.currency, self.account_info), - TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.version_two_attribute), + TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.resource_group_attribute), ] for generator in generators: with self.assertRaises(ValueError): @@ -132,7 +132,7 @@ def test_init_data_row_end_none(self): two_hours_ago = (self.now - self.one_hour) - self.one_hour generators = [ TestGenerator(two_hours_ago, self.now, self.currency, self.account_info), - TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.version_two_attribute), + TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.resource_group_attribute), ] for generator in generators: with self.assertRaises(ValueError): @@ -143,7 +143,7 @@ def test_init_data_row_start_invalid(self): two_hours_ago = (self.now - self.one_hour) - self.one_hour generators = [ TestGenerator(two_hours_ago, self.now, self.currency, self.account_info), - TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.version_two_attribute), + TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.resource_group_attribute), ] for generator in generators: with self.assertRaises(ValueError): @@ -154,7 +154,7 @@ def test_init_data_row_end_invalid(self): two_hours_ago = (self.now - self.one_hour) - self.one_hour generators = [ TestGenerator(two_hours_ago, self.now, self.currency, self.account_info), - TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.version_two_attribute), + TestGenerator(two_hours_ago, self.now, self.currency, self.account_info, self.resource_group_attribute), ] for generator in generators: with self.assertRaises(ValueError): @@ -222,7 +222,7 @@ def setUp(self): "usage_quantity": self.usage_quantity, "resource_rate": self.resource_rate, "pre_tax_cost": self.pre_tax_cost, - "version_two": True, + "resource_group": True, } self.two_hours_ago = (self.now - self.one_hour) - self.one_hour @@ -299,12 +299,10 @@ def test_update_data(self): start_row = {} row = generator._update_data(start_row, self.two_hours_ago, self.now) self.assertEqual(row["ConsumedService"], "Microsoft.Storage") - if generator.azure_columns == AZURE_COLUMNS: - self.assertEqual(row["ResourceType"], "Microsoft.Storage/storageAccounts") - self.assertEqual(row["SubscriptionGuid"], self.payer_account) - else: - self.assertIsNone(row.get("ResourceType")) + if generator.azure_columns == AZURE_COLUMNS_V2_SUBSCRIPTION: self.assertEqual(row["SubscriptionId"], self.payer_account) + else: + self.assertEqual(row["SubscriptionGuid"], self.payer_account) class TestSQLGenerator(AzureGeneratorTestCase): @@ -342,12 +340,10 @@ def test_update_data(self): start_row = {} row = generator._update_data(start_row, self.two_hours_ago, self.now) self.assertEqual(row["ConsumedService"], "Microsoft.Sql") - if generator.azure_columns == AZURE_COLUMNS: - self.assertEqual(row["ResourceType"], "Microsoft.Sql/servers") - self.assertEqual(row["SubscriptionGuid"], self.payer_account) - else: - self.assertIsNone(row.get("ResourceType")) + if generator.azure_columns == AZURE_COLUMNS_V2_SUBSCRIPTION: self.assertEqual(row["SubscriptionId"], self.payer_account) + else: + self.assertEqual(row["SubscriptionGuid"], self.payer_account) class TestVMGenerator(AzureGeneratorTestCase): @@ -385,12 +381,10 @@ def test_update_data(self): start_row = {} row = generator._update_data(start_row, self.two_hours_ago, self.now) self.assertEqual(row["ConsumedService"], "Microsoft.Compute") - if generator.azure_columns == AZURE_COLUMNS: - self.assertEqual(row["ResourceType"], "Microsoft.Compute/virtualMachines") - self.assertEqual(row["SubscriptionGuid"], self.payer_account) - else: - self.assertIsNone(row.get("ResourceType")) + if generator.azure_columns == AZURE_COLUMNS_V2_SUBSCRIPTION: self.assertEqual(row["SubscriptionId"], self.payer_account) + else: + self.assertEqual(row["SubscriptionGuid"], self.payer_account) class TestVNGenerator(AzureGeneratorTestCase): @@ -424,7 +418,6 @@ def test_update_data(self): start_row = {} row = generator._update_data(start_row, self.two_hours_ago, self.now) self.assertEqual(row["ConsumedService"], "Microsoft.Network") - self.assertEqual(row["ResourceType"], "Microsoft.Network/publicIPAddresses") def test_update_data_with_attributes(self): """Test that row is updated.""" @@ -436,12 +429,13 @@ def test_update_data_with_attributes(self): start_row = {} row = generator._update_data(start_row, self.two_hours_ago, self.now) self.assertEqual(row["Tags"], json.dumps(self.tags)) - if generator.azure_columns == AZURE_COLUMNS: - self.assertEqual(row["SubscriptionGuid"], self.payer_account) - self.assertEqual(row["InstanceId"], self.instance_id) - else: + if generator.azure_columns == AZURE_COLUMNS_V2_SUBSCRIPTION: self.assertEqual(row["SubscriptionId"], self.payer_account) self.assertEqual(row["ResourceId"], self.instance_id) + self.assertEqual(row["BillingCurrency"], self.currency) + else: + self.assertEqual(row["SubscriptionGuid"], self.payer_account) + self.assertEqual(row["BillingCurrencyCode"], self.currency) class TestDTGenerator(AzureGeneratorTestCase): @@ -476,7 +470,6 @@ def test_update_data(self): start_row = {} row = generator._update_data(start_row, self.two_hours_ago, self.now) self.assertEqual(row["ConsumedService"], "microsoft.compute") - self.assertEqual(row["ResourceType"], "microsoft.compute/publicIPAddresses") def test_update_data_with_attributes(self): """Test that row is updated.""" @@ -504,13 +497,7 @@ def test_update_data_with_attributes(self): start_row = {} row = generator._update_data(start_row, self.two_hours_ago, self.now) self.assertEqual(row["Tags"], json.dumps(self.tags)) - if generator.azure_columns == AZURE_COLUMNS: - self.assertEqual(row["SubscriptionGuid"], self.payer_account) - self.assertEqual(row["InstanceId"], self.instance_id) - self.assertEqual(row["MeterSubcategory"], "Virtual Network Private Link") - self.assertEqual(row["MeterName"], "Standard Data Processed - Ingress") - else: + if generator.azure_columns == AZURE_COLUMNS_V2_SUBSCRIPTION: self.assertEqual(row["SubscriptionId"], self.payer_account) - self.assertEqual(row["ResourceId"], self.instance_id) - self.assertEqual(row["MeterSubCategory"], "Virtual Network Private Link") - self.assertEqual(row["MeterName"], "Standard Data Processed - Ingress") + else: + self.assertEqual(row["SubscriptionGuid"], self.payer_account) diff --git a/tox.ini b/tox.ini index 2b1e4c61..16516896 100644 --- a/tox.ini +++ b/tox.ini @@ -11,6 +11,8 @@ max-complexity = 10 max-line-length = 120 import-order-style = pycharm application-import-names = nise +per-file-ignores = + __init__.py: F401 [testenv] passenv = CI TRAVIS TRAVIS_*