1. Perhaps getAuthenticatedAvatar should be named createAvatar?
2. Instead of defining __getattr__ on FakeProtocol, addStub should just create the function object and set it as an attribute on self. Also, I don't think "stub" is the right name for this, but whatever.
3. assertTrue is nicer than assert_.
4. Instead of assertEqual(type(foo), Quux), consider assertIsInstance(foo, Quux).
Yay, unit tests!
1. Perhaps getAuthenticate dAvatar should be named createAvatar?
2. Instead of defining __getattr__ on FakeProtocol, addStub should just create the function object and set it as an attribute on self. Also, I don't think "stub" is the right name for this, but whatever.
3. assertTrue is nicer than assert_.
4. Instead of assertEqual( type(foo) , Quux), consider assertIsInstanc e(foo, Quux).