Exemplo n.º 1
0
 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")
Exemplo n.º 2
0
 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")
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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))
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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))
Exemplo n.º 8
0
 def _does_generator_want_key(self, generator, key):
     for filter in generator.wanted_event_keys:
         if tuplematch.matchTuple(key, filter):
             return True
     return False
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 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)