def setUp(self): greeter = Stub('greeter') calling(greeter).passing('the name').returns('the greeting') self.controller = GreetingController(greeter) self.request = Stub('request', kwargs={'name': 'the name'}) self.response = Mock('response')
def setUp(self): # use stubs to provide canned responses to queries: prompter = Stub() calling(prompter).passing('First name:').returns('Justin') calling(prompter).passing('Last name:').returns('Blake') # use mocks to verify commands: self.printer = Mock() self.greeter = Greeter(prompter, self.printer)
def setUp(self): # use stubs to provide canned responses to queries: prompter = Stub() calling(prompter).passing("First name:").returns("Justin") calling(prompter).passing("Last name:").returns("Blake") # use mocks to verify commands: self.printer = Mock() self.greeter = Greeter(prompter, self.printer)
def setUp(self): # use stubs to provide canned responses to queries: prompter = Stub() calling(prompter).passing('First name:').returns('Justin') calling(prompter).passing('Last name:').returns('Blake') # use spies to verify commands: self.printer = Spy() self.greeter = Greeter(prompter, self.printer)
def setUp(self): super(TestRouterCall, self).setUp() self.environ = {'PATH_INFO': '/path'} start_response = Stub('start_response') route = Stub('route', kwargs={'expected': 'kwargs'}) calling(route.endpoint).passing(self.environ, start_response).returns( 'endpoint response') calling(self.routes.get).passing('/path').returns(route) self.response = self.router(self.environ, start_response)