def test_disabled(self): obj = ConsoleStatusReporter() obj.engine = EngineEmul() obj.engine.provisioning = Local() obj.engine.config[Provisioning.PROV] = '' jmeter = self.get_jmeter() jmeter.engine = obj.engine jmeter.start_time = time.time() jmeter.execution[ScenarioExecutor.HOLD_FOR] = 10 obj.engine.provisioning.executors = [jmeter] obj.settings["disable"] = True obj.settings['dummy_cols'] = 160 obj.settings['dummy_rows'] = 40 obj.prepare() obj.startup() for n in range(0, 10): point = self.__get_datapoint(0) obj.aggregated_second(point) obj.check() self.assertFalse(obj.screen.started) obj.check() obj.shutdown() obj.post_process()
def test_disabled_0(self): obj = ConsoleStatusReporter() obj.engine = EngineEmul() obj.engine.provisioning = Local() obj.engine.config[Provisioning.PROV] = '' obj.settings["disable"] = 0 obj.prepare() self.assertEquals(False, obj.disabled)
def test_screen_invalid(self): obj = ConsoleStatusReporter() obj.settings["screen"] = "invalid" if not (sys.stdout and sys.stdout.isatty()): self.assertEqual(obj._get_screen_type(), "dummy") elif is_windows(): self.assertEqual(obj._get_screen(), "gui") else: self.assertEqual(obj._get_screen_type(), "console")
def test_screen(self): isatty = sys.stdout.isatty sys.stdout.isatty = lambda: True obj = ConsoleStatusReporter() obj.settings["screen"] = "console" if not is_windows(): self.assertIsInstance(obj._get_screen(), ConsoleScreen) else: self.assertIsInstance(obj._get_screen(), GUIScreen) sys.stdout.isatty = isatty
def test_1(self): obj = ConsoleStatusReporter() handler = RecordingHandler() obj.log.addHandler(handler) obj.engine = EngineEmul() obj.engine.provisioning = Local() obj.engine.provisioning.start_time = time.time() obj.engine.config[Provisioning.PROV] = '' jmeter = self.get_jmeter() jmeter.engine = obj.engine jmeter.execution[ScenarioExecutor.HOLD_FOR] = 10 jmeter.execution.merge({'hold-for': 0, 'ramp-up': 0}) jmeter.delay = 10 jmeter.prepare() widget = jmeter.get_widget() widget.update() jmeter.startup() widget.update() obj.engine.provisioning.executors = [jmeter] obj.settings["disable"] = False obj.settings['dummy_cols'] = 160 obj.settings['dummy_rows'] = 40 obj.settings['disable'] = False obj.prepare() obj.startup() obj.check() obj.temp_stream.write("test1\n") obj.temp_stream.flush() obj.temp_stream.write("test1\n") obj.temp_stream.flush() obj.check() for n in range(0, 10): point = self.__get_datapoint(n) obj.aggregated_second(point) obj.temp_stream.write("test %s\n" % n) obj.temp_stream.flush() obj.check() self.assertTrue(obj.screen.started) point = self.__get_datapoint(11) point[DataPoint.CURRENT][''][KPISet.RESP_CODES][''] = 1 obj.aggregated_second(point) obj.check() obj.shutdown() obj.post_process() obj.log.removeHandler(handler) self.assertNotIn('Failed', handler.warn_buff.getvalue())
def test_1(self): obj = ConsoleStatusReporter() obj.engine = EngineEmul() obj.engine.provisioning = Local() obj.engine.provisioning.start_time = time.time() obj.engine.config[Provisioning.PROV] = '' jmeter = self.get_jmeter() jmeter.engine = obj.engine jmeter.execution[ScenarioExecutor.HOLD_FOR] = 10 jmeter.execution.merge({'hold-for': 0, 'ramp-up': 0}) jmeter.delay = 10 jmeter.prepare() widget = jmeter.get_widget() widget.update() jmeter.startup() widget.update() obj.engine.provisioning.executors = [jmeter] obj.settings["disable"] = False obj.settings['dummy_cols'] = 160 obj.settings['dummy_rows'] = 40 obj.settings['disable'] = False obj.prepare() obj.startup() obj.check() obj.temp_stream.write("test1\n") obj.temp_stream.flush() obj.temp_stream.write("test1\n") obj.temp_stream.flush() obj.check() for n in range(0, 10): point = self.__get_datapoint(n) obj.aggregated_second(point) obj.temp_stream.write("test %s\n" % n) obj.temp_stream.flush() obj.check() self.assertTrue(obj.screen.started) obj.check() obj.shutdown() obj.post_process()