def test_multiple_devicegroups(self): options = Options() options.device = "devicegroup:this_should_not_exist_1;devicegroup:" "this_should_not_exist_either" options.timeout = 1 test = SystemTest(self).run(options).verify(Result.ERROR) testrun_id1 = test.testrun_ids[0] testrun_id2 = test.testrun_ids[1] self.assertTrue(log_page_contains_errors(testrun_id1)) self.assertTrue(log_page_contains_errors(testrun_id2)) # Make sure correct routing keys are used (We don't know the order so # we need to do check both ways) string1 = """No queue for this_should_not_exist_1""" string2 = """No queue for this_should_not_exist_either""" if log_page_contains_message(testrun_id1, string1): assert_log_page_contains_message(self, testrun_id2, string2) else: assert_log_page_contains_message(self, testrun_id2, string1) assert_log_page_contains_message(self, testrun_id1, string2)
def test_one_devicegroup_one_devicename_multiple_device_ids(self): options = Options() options.device = "devicegroup:this_should_not_exist devicename:" \ "device1 deviceid:id1;devicegroup:this_should_not_exist " \ "devicename:device1 deviceid:id2" options.timeout = 1 test = SystemTest(self).run(options).verify(Result.ERROR) testrun_id1 = test.testrun_ids[0] testrun_id2 = test.testrun_ids[1] self.assertTrue(log_page_contains_errors(testrun_id1)) self.assertTrue(log_page_contains_errors(testrun_id2)) # Make sure correct routing keys are used string1 = """No queue for this_should_not_exist.device1.id1""" string2 = """No queue for this_should_not_exist.device1.id2""" if (log_page_contains_message(testrun_id1, string1)): assert_log_page_contains_message(self, testrun_id2, string2) else: assert_log_page_contains_message(self, testrun_id2, string1) assert_log_page_contains_message(self, testrun_id1, string2)
def test_multiple_devicegroups(self): options = Options() options.device = "devicegroup:this_should_not_exist_1;devicegroup:" \ "this_should_not_exist_either" options.timeout = 1 test = SystemTest(self).run(options).verify(Result.ERROR) testrun_id1 = test.testrun_ids[0] testrun_id2 = test.testrun_ids[1] self.assertTrue(log_page_contains_errors(testrun_id1)) self.assertTrue(log_page_contains_errors(testrun_id2)) # Make sure correct routing keys are used (We don't know the order so # we need to do check both ways) string1 = """No queue for this_should_not_exist_1""" string2 = """No queue for this_should_not_exist_either""" if (log_page_contains_message(testrun_id1, string1)): assert_log_page_contains_message(self, testrun_id2, string2) else: assert_log_page_contains_message(self, testrun_id2, string1) assert_log_page_contains_message(self, testrun_id1, string2)
def test_one_devicegroup_one_devicename_multiple_device_ids(self): options = Options() options.device = ( "devicegroup:this_should_not_exist devicename:" "device1 deviceid:id1;devicegroup:this_should_not_exist " "devicename:device1 deviceid:id2" ) options.timeout = 1 test = SystemTest(self).run(options).verify(Result.ERROR) testrun_id1 = test.testrun_ids[0] testrun_id2 = test.testrun_ids[1] self.assertTrue(log_page_contains_errors(testrun_id1)) self.assertTrue(log_page_contains_errors(testrun_id2)) # Make sure correct routing keys are used string1 = """No queue for this_should_not_exist.device1.id1""" string2 = """No queue for this_should_not_exist.device1.id2""" if log_page_contains_message(testrun_id1, string1): assert_log_page_contains_message(self, testrun_id2, string2) else: assert_log_page_contains_message(self, testrun_id2, string1) assert_log_page_contains_message(self, testrun_id1, string2)
def assert_log_page_does_not_contain_message(test, testrun_id, string): test.assertFalse( log_page_contains_message(testrun_id, string), "Found text '%s' in testrun '%s'." % (string, testrun_log_url(testrun_id)))
def assert_log_page_contains_message(test, testrun_id, string): test.assertTrue( log_page_contains_message(testrun_id, string), "Missing text '%s' in testrun '%s'." % (string, testrun_log_url(testrun_id)))
def assert_log_page_does_not_contain_message(test, testrun_id, string): test.assertFalse(log_page_contains_message(testrun_id, string), "Found text '%s' in testrun '%s'." % (string, testrun_log_url(testrun_id)))
def assert_log_page_contains_message(test, testrun_id, string): test.assertTrue(log_page_contains_message(testrun_id, string), "Missing text '%s' in testrun '%s'." % (string, testrun_log_url(testrun_id)))