Replacing a method without passthrough.
After being introduced to Mocker by Mike at a recent Portland Python meeting, I'm trying it out with this integration test I'm writing. There's one part left I'm not quite sure how to do, which looks something like this:
class Message(object):
def send(self, destination):
# Does network stuff I don't want the tests to invoke.
class OurClass(object):
messageClass = Message
def __init__(self, where):
self.there = where
def yell(self):
m = self.messageClass()
class TestWithoutMock
def test_yell(self):
send_list = []
class FakeMessage(
def send(self, destination):
# Don't passthrough! That would be bad.
that = OurClass("there")
that.yell()
# end
I tried to figure out how to use mocker to provide an expectation and result for Message.send without passthrough, but I haven't quite got it yet.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Mocker Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Gustavo Niemeyer
- Solved:
- Last query:
- Last reply: