def test_total_percent(self):
        process_cpu_usage = ProcessCpuUsage(1,1.34,self.__metric_repository)
        test_user_percent = float("%.2f"%(100*(112233 -112223)/(1.34*1000)))
        test_guest_percent = float("%.2f"%(100*(112213-112203)/(1.34*1000)))
        test_system_percent = float("%.2f"%(100*(112243-112233)/(1.34*1000)))
        test_total_percent = test_user_percent+test_guest_percent+test_system_percent

        total_percent = process_cpu_usage.total_percent()

        self.assertEquals(total_percent, test_total_percent)
示例#2
0
    def test_total_percent_if_previous_value_None(self):
        process_cpu_usage = ProcessCpuUsage(2,1.34,self.__metric_repository)

        total_percent = process_cpu_usage.total_percent()

        self.assertIsNone(total_percent, None)
示例#3
0
    def test_total_percent(self):
        process_cpu_usage = ProcessCpuUsage(1,1.34,self.__metric_repository)

        total_percent = process_cpu_usage.total_percent()

        self.assertEquals(total_percent, 2.25)
示例#4
0
    def test_total_percent_if_previous_value_None(self):
        process_cpu_usage = ProcessCpuUsage(2, 1.34, self.__metric_repository)

        total_percent = process_cpu_usage.total_percent()

        self.assertIsNone(total_percent, None)
示例#5
0
    def test_total_percent(self):
        process_cpu_usage = ProcessCpuUsage(1, 1.34, self.__metric_repository)

        total_percent = process_cpu_usage.total_percent()

        self.assertEquals(total_percent, 2.25)