コード例 #1
0
    def test_print_report_without_filtering(self):
        process_stack_util = Mock()
        process_filter = Mock()
        printer = Mock()
        process_filter.filter_processes = Mock(return_value=self.processes)
        reporter = CpuProcessStackUtilReporter(process_stack_util, process_filter, printer, self.options)

        reporter.print_report(123)

        printer.assert_called_with("123\t1000\t1\t136\tprocess_1")
コード例 #2
0
    def test_print_report_header(self):
        process_stack_util = Mock()
        process_filter = Mock()
        printer = Mock()
        process_filter.filter_processes = Mock(return_value=self.processes)
        reporter = CpuProcessStackUtilReporter(process_stack_util, process_filter, printer, self.options)

        reporter.print_report(123, "  ", "    ")

        printer.assert_any_call("Timestamp  UID\tPID\tStkSize\tCommand")
コード例 #3
0
    def test_print_report_with_user_name(self):
        self.options.show_process_user = '******'
        process_stack_util = Mock()
        process_filter = Mock()
        printer = Mock()
        process_filter.filter_processes = Mock(return_value=self.processes)
        reporter = CpuProcessStackUtilReporter(process_stack_util, process_filter, printer, self.options)

        reporter.print_report(123)

        printer.assert_called_with("123\tpcp\t1\t136\tprocess_1")
コード例 #4
0
    def test_print_report_without_filtering(self):
        process_stack_util = Mock()
        process_filter = Mock()
        printer = Mock()
        process_filter.filter_processes = Mock(return_value=self.processes)
        reporter = CpuProcessStackUtilReporter(process_stack_util,
                                               process_filter, printer,
                                               self.options)

        reporter.print_report(123)

        printer.assert_called_with("123\t1000\t1\t136\tprocess_1")
コード例 #5
0
    def test_print_report_header(self):
        process_stack_util = Mock()
        process_filter = Mock()
        printer = Mock()
        process_filter.filter_processes = Mock(return_value=self.processes)
        reporter = CpuProcessStackUtilReporter(process_stack_util,
                                               process_filter, printer,
                                               self.options)

        reporter.print_report(123, "  ", "    ")

        printer.assert_any_call("Timestamp  UID\tPID\tStkSize\tCommand")
コード例 #6
0
    def test_print_report_with_user_name(self):
        self.options.show_process_user = '******'
        process_stack_util = Mock()
        process_filter = Mock()
        printer = Mock()
        process_filter.filter_processes = Mock(return_value=self.processes)
        reporter = CpuProcessStackUtilReporter(process_stack_util,
                                               process_filter, printer,
                                               self.options)

        reporter.print_report(123)

        printer.assert_called_with("123\tpcp\t1\t136\tprocess_1")