def callConsumer(self, routingKey, msg): if self.verifyMessages: validation.verifyMessage(self.testcase, routingKey, msg) matched = False for q in self.qrefs: if tuplematch.matchTuple(routingKey, q.filter): matched = True q.callback(routingKey, msg) if not matched: raise AssertionError("no consumer found")
def produce(self, routingKey, data): if self.debug: log.msg("MSG: {}\n{}".format(routingKey, pprint.pformat(data))) for qref in self.qrefs: if tuplematch.matchTuple(routingKey, qref.filter): self.invokeQref(qref, routingKey, data)
def do_test_match(self, routingKey, shouldMatch, filter): result = tuplematch.matchTuple(routingKey, filter) self.assertEqual( shouldMatch, result, '%r %s %r' % (routingKey, 'should match' if shouldMatch else "shouldn't match", filter))
def produce(self, routingKey, data): if self.debug: log.msg("MSG: %s\n%s" % (routingKey, pprint.pformat(data))) for qref in self.qrefs: if tuplematch.matchTuple(routingKey, qref.filter): qref.invoke(routingKey, data)
def do_test_match(self, routingKey, shouldMatch, filter): result = tuplematch.matchTuple(routingKey, filter) self.assertEqual(shouldMatch, result, '%r %s %r' % (routingKey, 'should match' if shouldMatch else "shouldn't match", filter))
def _does_generator_want_key(self, generator, key): for filter in generator.wanted_event_keys: if tuplematch.matchTuple(key, filter): return True return False
def do_test_match(self, routingKey, shouldMatch, filter): result = tuplematch.matchTuple(routingKey, filter) msg = '{} {} {}'.format( repr(routingKey), 'should match' if shouldMatch else "shouldn't match", repr(filter)) self.assertEqual(shouldMatch, result, msg)
def do_test_match(self, routingKey, shouldMatch, filter): result = tuplematch.matchTuple(routingKey, filter) should_match_string = 'should match' if shouldMatch else "shouldn't match" msg = f"{repr(routingKey)} {should_match_string} {repr(filter)}" self.assertEqual(shouldMatch, result, msg)