Exemple #1
0
    def configure(self):
        self.info_panel_width = self.get_option("info_panel_width", self.info_panel_width)
        self.short_only = int(self.get_option("short_only", '0'))
        if not int(self.get_option("disable_all_colors", '0')):
            self.console_markup = RealConsoleMarkup()
        else:
            self.console_markup = NoConsoleMarkup()
        for color in self.get_option("disable_colors", '').split(' '):
            self.console_markup.__dict__[color] = ''
        self.screen = Screen(self.info_panel_width, self.console_markup)

        try:
            aggregator = self.core.get_plugin_of_type(AggregatorPlugin)
            aggregator.add_result_listener(self)
        except KeyError:
            self.log.debug("No aggregator for console")
            self.screen.block_rows = []
            self.screen.info_panel_percent = 100
    def test_HTTP(self):
        screen = Screen(50, FakeConsoleMarkup())
        block = CurrentHTTPBlock(screen)
        block.render()
        print block.lines
        self.assertEquals('<w>HTTP for 0 RPS:  <rst>', block.lines[0].strip())
        self.assertEquals(1, len(block.lines))

        data = self.get_aggregate_data('data/preproc_single.txt')
        data.overall.planned_requests = 100
        data.overall.http_codes = {'400': 10}
        block.add_second(data)
        block.render()
        print block.lines
        self.assertEquals(2, len(block.lines))

        data.overall.http_codes = {'200': 4}
        block.add_second(data)
        block.render()
        print block.lines
        self.assertEquals(3, len(block.lines))