~ssweeny/friends/fix-lp1258657

« back to all changes in this revision

Viewing changes to friends/tests/test_account.py

  • Committer: Robert Bruce Park
  • Date: 2013-03-19 20:12:10 UTC
  • mto: (188.5.10 friends)
  • mto: This revision was merged to the branch mainline in revision 201.
  • Revision ID: robert.park@canonical.com-20130319201210-epsi4ed5sqc59ktp
De-twingle our Account wrapper class from the Authentication class.

This means our Authentication code functions directly on accounts-sso
API calls, with one less layer of glue obfuscating everything.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        self.assertFalse(hasattr(self.account, 'bee'))
129
129
        self.assertFalse(hasattr(self.account, 'cat'))
130
130
 
 
131
    @mock.patch('friends.utils.account.manager')
131
132
    @mock.patch('friends.utils.account.Account')
132
133
    @mock.patch('friends.utils.account.Accounts')
133
 
    def test_find_accounts(self, accts, acct, *ignore):
 
134
    def test_find_accounts(self, accts, acct, manager):
134
135
        service = mock.Mock()
135
 
        manager = accts.Manager.new_for_service_type
136
 
        get_enabled = manager().get_enabled_account_services
 
136
        get_enabled = manager.get_enabled_account_services
137
137
        get_enabled.return_value = [service]
138
138
        manager.reset_mock()
139
139
        accounts = _find_accounts_uoa()
140
 
        manager.assert_called_once_with('microblogging')
141
140
        get_enabled.assert_called_once_with()
142
141
        acct.assert_called_once_with(service)
143
142
        self.assertEqual(accounts, {acct().id: acct()})