示例#1
0
 def test_get_cloud_account_overview_with_openshift_and_rhel_image(self):
     """Assert an account overview reports openshift and rhel correctly."""
     powered_times = (
         (
             util_helper.utc_dt(2018, 1, 10, 0, 0, 0),
             util_helper.utc_dt(2018, 1, 10, 5, 0, 0)
         ),
     )
     account_helper.generate_aws_instance_events(
         self.instance_1, powered_times,
         self.windows_image.ec2_ami_id
     )
     # in addition to instance_1's events, we are creating an event for
     # instance_2 with a rhel & openshift_image
     account_helper.generate_single_aws_instance_event(
         self.instance_2, self.start, InstanceEvent.TYPE.power_on,
         self.openshift_and_rhel_image.ec2_ami_id)
     overview = reports.get_account_overview(
         self.account, self.start, self.end)
     # we expect to find 2 total images, 2 total instances, 1 rhel instance
     # and 1 openshift instance
     self.assertExpectedAccountOverview(overview, self.account,
                                        images=2, instances=2,
                                        rhel_instances=1,
                                        openshift_instances=1)
示例#2
0
 def test_get_cloud_account_overview_account_creation_on(self):
     """Assert an overview of an account created on end reports None."""
     overview = reports.get_account_overview(
         self.account_on_end, self.start, self.end)
     self.assertExpectedAccountOverview(overview, self.account_on_end,
                                        images=None, instances=None,
                                        rhel_instances=None,
                                        openshift_instances=None)
示例#3
0
 def test_get_cloud_account_overview_with_events(self):
     """Assert an account overview reports instances/images correctly."""
     powered_times = (
         (
             util_helper.utc_dt(2018, 1, 10, 0, 0, 0),
             util_helper.utc_dt(2018, 1, 10, 5, 0, 0)
         ),
     )
     account_helper.generate_aws_instance_events(
         self.instance_1, powered_times,
         self.windows_image.ec2_ami_id
     )
     overview = reports.get_account_overview(
         self.account, self.start, self.end)
     self.assertExpectedAccountOverview(overview, self.account,
                                        images=1, instances=1)
示例#4
0
 def test_get_cloud_account_overview_with_openshift(self):
     """Assert an account overview reports openshift correctly."""
     # generate event for instance_1 with the rhel/openshift image
     account_helper.generate_single_aws_instance_event(
         self.instance_1, self.start, InstanceEvent.TYPE.power_on,
         self.openshift_and_rhel_image.ec2_ami_id)
     # generate event for instance_2 with the openshift image
     account_helper.generate_single_aws_instance_event(
         self.instance_2, self.start, InstanceEvent.TYPE.power_on,
         self.openshift_image.ec2_ami_id)
     overview = reports.get_account_overview(
         self.account, self.start, self.end)
     # assert that we only find the two openshift images
     self.assertExpectedAccountOverview(overview, self.account,
                                        images=2, instances=2,
                                        rhel_instances=1,
                                        openshift_instances=2)
示例#5
0
 def get_overview(self, account):
     """Generate the cloud account overview and return the results."""
     return reports.get_account_overview(account, **self.validated_data)
示例#6
0
 def test_get_cloud_account_overview_no_events(self):
     """Assert an overview of an account with no events returns 0s."""
     overview = reports.get_account_overview(
         self.account, self.start, self.end)
     self.assertExpectedAccountOverview(overview, self.account)