Ejemplo n.º 1
0
 def test_get_replay_wrong_query(self):
     # We don't actually test with a wrong query, we just throw back an
     # error from the store.
     self.config['persistent_store'].get = Mock(
         side_effect=[ValueError("this is an error")])
     self.replay_thread.start()
     msgs = list(
         get_replay(local_name, {"seq_ids": [1, 2]}, self.config,
                    self.context))
Ejemplo n.º 2
0
 def test_get_replay_wrong_query(self):
     # We don't actually test with a wrong query, we just throw back an
     # error from the store.
     self.config['persistent_store'].get = Mock(
         side_effect=[ValueError("this is an error")])
     self.replay_thread.start()
     msgs = list(get_replay(
         local_name, {"seq_ids": [1, 2]}, self.config, self.context
     ))
Ejemplo n.º 3
0
 def test_get_replay(self):
     # As before, the correctness of the query doesn't matter much
     # since it is taken care of on the server side.
     orig_msg = {
         "i": 2,
         "seq_id": 3,
         "topic": "org.foo.bar",
         "msg_id": "33333333-3333-3333-3333-333333333333",
         "timestamp": 20,
         "msg": {"foo": "foo"}
     }
     self.config['persistent_store'].get = Mock(side_effect=[[orig_msg]])
     self.replay_thread.start()
     msgs = list(get_replay(
         local_name, {"seq_id": 3}, self.config, self.context
     ))
     assert len(msgs) == 1
     self.assertDictEqual(msgs[0], orig_msg)
Ejemplo n.º 4
0
 def test_get_replay(self):
     # As before, the correctness of the query doesn't matter much
     # since it is taken care of on the server side.
     orig_msg = {
         "i": 2,
         "seq_id": 3,
         "topic": "org.foo.bar",
         "msg_id": "33333333-3333-3333-3333-333333333333",
         "timestamp": 20,
         "msg": {
             "foo": "foo"
         }
     }
     self.config['persistent_store'].get = Mock(side_effect=[[orig_msg]])
     self.replay_thread.start()
     msgs = list(
         get_replay(local_name, {"seq_id": 3}, self.config, self.context))
     assert len(msgs) == 1
     self.assertDictEqual(msgs[0], orig_msg)
Ejemplo n.º 5
0
 def test_get_replay_no_available_endpoint(self):
     #self.replay_thread.start()
     msgs = list(
         get_replay("phony", {"seq_ids": [1, 2]}, self.config,
                    self.context))
Ejemplo n.º 6
0
 def test_get_replay_no_available_endpoint(self):
     #self.replay_thread.start()
     msgs = list(get_replay(
         "phony", {"seq_ids": [1, 2]}, self.config, self.context
     ))