Example #1
0
 def test_generate_data(self):
     """Test that the VPC generate_data method works."""
     generator = VPCGenerator(self.two_hours_ago, self.now,
                              self.payer_account, self.usage_accounts,
                              self.attributes)
     data = generator.generate_data()
     self.assertNotEqual(data, [])
Example #2
0
    def test_update_data(self):
        """Test VPC specific update data method."""
        generator = VPCGenerator(self.two_hours_ago, self.now)
        start_row = {}
        row = generator._update_data(start_row, self.two_hours_ago, self.now,
                                     **{"config": generator.config[0]})

        self.assertEqual(row["product/servicecode"], "AmazonVPC")
        self.assertEqual(row["lineItem/Operation"], "CreateVpnConnection")
        self.assertEqual(row["lineItem/ProductCode"], "AmazonVPC")
Example #3
0
    def test_update_data(self):
        """Test VPC specific update data method."""
        generator = VPCGenerator(self.two_hours_ago, self.now,
                                 self.payer_account, self.usage_accounts,
                                 self.attributes)
        start_row = {}
        row = generator._update_data(start_row, self.two_hours_ago, self.now)

        self.assertEqual(row["product/servicecode"], "AmazonVPC")
        self.assertEqual(row["lineItem/Operation"], "CreateVpnConnection")
        self.assertEqual(row["lineItem/ProductCode"], "AmazonVPC")
Example #4
0
    def test_init_with_attributes(self):
        """Test the unique init options for Data Transfer."""

        generator = VPCGenerator(self.two_hours_ago, self.now,
                                 self.payer_account, self.usage_accounts,
                                 self.attributes)
        self.assertEqual(generator._product_sku, self.product_sku)
        self.assertEqual(generator._tags, self.tags)
        self.assertEqual(generator._resource_id, "vpn-" + self.resource_id)
Example #5
0
    def test_init_with_attributes(self):
        """Test the unique init options for Data Transfer."""

        test_args = self.test_config_kwargs
        test_args["generator"] = "VPCGenerator"
        test_config = create_test_config(**test_args)
        generator = VPCGenerator(self.two_hours_ago,
                                 self.now,
                                 user_config=test_config)
        self.assertEqual(generator.config[0].get("product_sku"),
                         self.product_sku)
        self.assertIn(self.tags["key"], generator.config[0].get("tags").keys())
        self.assertEqual(generator.config[0].get("resource_id"),
                         self.resource_id)
        os.remove(test_config)
Example #6
0
 def test_generate_data(self):
     """Test that the VPC generate_data method works."""
     generator = VPCGenerator(self.two_hours_ago, self.now)
     data = generator.generate_data()
     self.assertNotEqual(data, [])