ooici/pyon — pull request #7 by ifreecarve (2011-12-14 22:21:32+00:00)
Title: allow assignment of mocked clients by returning the result

Allows more understandable code in a unit test:

```python
def setUp(self):
# Create an IonObject mock for the examples/bank/trade_service.py module.
# the argument is the scope + ".IonObject"
self.mock_ionobj = self._create_IonObject_mock('examples.bank.trade_service.IonObject')

# Create mocks for all services (clients) used in the service named "trade"
# they will be saved to self.clients
mocked_trade_service_clients = self._create_service_mock('trade')

# Create an instance of the service we want to test
self.trade_service = TradeService()

# replace the trade service's clients with the mocked clients
self.trade_service.clients = mocked_trade_service_clients

# Rename methods we'll use, to save some typing
# * It's also acceptable to say this as:
# self.mock_create = mocked_trade_service_clients.resource_registry.create
self.mock_create = self.trade_service.clients.resource_registry.create

```