Code review comment for lp:~cerberus/nova/nova_notifications

Revision history for this message
Rick Harris (rconradharris) wrote :

> Your way would create variables scope local to the mock method only, so there would be no way of checking them later in the test.

A bit of a hack, but, one way around this is to create a locally-scoped dict which the mocked function can mutate.

monitored = dict(notified=False)
def fake_notify():
    monitored['notified'] = True

self.assertTrue(monitored['notified])

(* Neutral on whether it should be used in this case *)

« Back to merge proposal