def test_result_stream(self): test = Test(self.client) result_stream = test.result_stream() self.assertTrue(isinstance(result_stream, _TestResultStream)) self.assertEqual(result_stream.test, test) self.assertEqual(result_stream.result_ids, [ TestResult.result_id_from_name(TestResult.USER_LOAD_TIME, load_zone_id=LoadZone.name_to_id( LoadZone.AGGREGATE_WORLD)), TestResult.result_id_from_name(TestResult.ACTIVE_USERS, load_zone_id=LoadZone.name_to_id( LoadZone.AGGREGATE_WORLD)) ])
def test_result_stream(self): test = Test(self.client) result_stream = test.result_stream() self.assertTrue(isinstance( result_stream, _TestResultStream)) self.assertEqual(result_stream.test, test) self.assertEqual(result_stream.result_ids, [TestResult.result_id_from_name( TestResult.USER_LOAD_TIME, load_zone_id=LoadZone.name_to_id(LoadZone.AGGREGATE_WORLD)), TestResult.result_id_from_name( TestResult.ACTIVE_USERS, load_zone_id=LoadZone.name_to_id(LoadZone.AGGREGATE_WORLD))])
def test_result_id_for_page(self): name = 'my page' result_id = TestResult.result_id_for_page(name, 1, 1) if sys.version_info >= (3, 0) and isinstance(name, str): name = name.encode('utf-8') self.assertEqual(result_id, '__li_page%s:1:1' % hashlib.md5(name).hexdigest())
def test_result_id_from_custom_metric_name(self): name = 'my metric' result_id = TestResult.result_id_from_custom_metric_name(name, 1, 1) if sys.version_info >= (3, 0) and isinstance(name, str): name = name.encode('utf-8') self.assertEqual(result_id, '__custom_%s:1:1' % hashlib.md5(name).hexdigest())
def test_result_id_for_page(self): name = 'my page' result_id = TestResult.result_id_for_page(name, 1, 1) if sys.version_info >= (3, 0) and isinstance(name, str): name = name.encode('utf-8') self.assertEqual(result_id, '__li_page_%s:1:1' % hashlib.md5(name).hexdigest())
def test_result_id_for_url(self): url = 'http://example.com/' result_id = TestResult.result_id_for_url(url, 1, 1, method='GET', status_code=200) if sys.version_info >= (3, 0) and isinstance(url, str): url = url.encode('utf-8') self.assertEqual(result_id, '__li_url%s:1:1:200:GET' % hashlib.md5(url).hexdigest())
def test_result_id_from_name_with_name_load_zone_user_scenario(self): self.assertEqual(TestResult.result_id_from_name('__li_user_load_time', load_zone_id=1, user_scenario_id=1), '__li_user_load_time:1:1')
def test_result_id_from_name_with_name(self): self.assertEqual(TestResult.result_id_from_name('__li_user_load_time'), '__li_user_load_time')
def test_result_id_from_name_with_name_load_zone_user_scenario(self): self.assertEqual( TestResult.result_id_from_name('__li_user_load_time', load_zone_id=1, user_scenario_id=1), '__li_user_load_time:1:1')