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 verify(self, expected_result): if expected_result == Result.ERROR: for id in self.testrun_ids: self._assert_result(expected_result, Result.ERROR) self.test.assertTrue(log_page_contains_errors(id), "There should be errors in testrun %s." % testrun_log_url(id)) elif expected_result == Result.FAIL: self._assert_result(expected_result, Result.FAIL) elif expected_result == Result.PASS: for id in self.testrun_ids: self._assert_result(expected_result, Result.PASS) assert_log_page_contains_messages(self.test, id, \ COMMON_SUCCESS_MESSAGES) self.test.assertFalse(log_page_contains_errors(id), \ "Found errors in log %s" % id) else: raise Exception('Unknown expected result \'%s\'. Actual result: %s' % (expected_result, self.result)) return self
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 verify(self, expected_result): if expected_result == Result.ERROR: for id in self.testrun_ids: self._assert_result(expected_result, Result.ERROR) self.test.assertTrue( log_page_contains_errors(id), "There should be errors in testrun %s." % testrun_log_url(id)) elif expected_result == Result.FAIL: self._assert_result(expected_result, Result.FAIL) elif expected_result == Result.PASS: for id in self.testrun_ids: self._assert_result(expected_result, Result.PASS) assert_log_page_contains_messages(self.test, id, \ COMMON_SUCCESS_MESSAGES) self.test.assertFalse(log_page_contains_errors(id), \ "Found errors in log %s" % id) else: raise Exception( 'Unknown expected result \'%s\'. Actual result: %s' % (expected_result, self.result)) return self