- monkeypatch.setattr("rmr.rmr.rmr_send_msg", rmr_mocks.send_mock_generator(10))
-
- # we need this because free expects a real sbuf
- # TODO: move this into rmr_mocks
- def noop(_sbuf):
- pass
-
- monkeypatch.setattr("rmr.rmr.rmr_free_msg", noop)
-
- # we need to repatch alloc (already patched in patch_rmr) to fix the transactionid, alloc is called in send and recieve
- def fake_alloc(_unused1, _unused2, _unused3, _unused4, _unused5):
- sbuf = rmr_mocks.Rmr_mbuf_t()
- sbuf.contents.xaction = b"d49b53e478b711e9a1130242ac110002"
- return sbuf
-
- # we also need to repatch set, since in the send function, we alloc, then set a new transid
- def fake_set_transactionid(sbuf):
- sbuf.contents.xaction = b"d49b53e478b711e9a1130242ac110002"
-
- # Note, we could have just patched summary, but this patches at a "lower level" so is a better test
- monkeypatch.setattr("rmr.rmr.rmr_alloc_msg", fake_alloc)
- monkeypatch.setattr("rmr.rmr.generate_and_set_transaction_id", fake_set_transactionid)