~ssweeny/friends/fix-lp1258657

« back to all changes in this revision

Viewing changes to friends/tests/test_flickr.py

  • Committer: Robert Bruce Park
  • Date: 2013-05-01 17:05:12 UTC
  • mfrom: (160.11.31 trunk-next)
  • Revision ID: robert.park@canonical.com-20130501170512-d3xrvv4vmv24k3ir
Land trunk-next into lp:friends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        # But also no photos.
87
87
        self.assertEqual(TestModel.get_n_rows(), 0)
88
88
 
 
89
    @mock.patch('friends.utils.authentication.manager')
 
90
    @mock.patch('friends.utils.authentication.Accounts')
89
91
    @mock.patch.dict('friends.utils.authentication.__dict__', LOGIN_TIMEOUT=1)
90
92
    @mock.patch('friends.utils.authentication.Signon.AuthSession.new')
91
93
    @mock.patch('friends.utils.http.Soup.Message',
95
97
        # AccessToken, but this fails.
96
98
        self.assertRaises(AuthorizationError, self.protocol.receive)
97
99
 
 
100
    @mock.patch('friends.utils.authentication.manager')
 
101
    @mock.patch('friends.utils.authentication.Accounts')
98
102
    @mock.patch('friends.utils.http.Soup.Message',
99
103
                FakeSoupMessage('friends.tests.data', 'flickr-nophotos.dat'))
 
104
    @mock.patch('friends.utils.authentication.Authentication.__init__',
 
105
                return_value=None)
100
106
    @mock.patch('friends.utils.authentication.Authentication.login',
101
107
                return_value=dict(username='Bob Dobbs',
102
108
                                  user_nsid='bob',
103
109
                                  AccessToken='123',
104
110
                                  TokenSecret='abc'))
105
 
    def test_login_successful_authentication(self, mock):
 
111
    def test_login_successful_authentication(self, *mocks):
106
112
        # Logging in required communication with the account service to get an
107
113
        # AccessToken, but this fails.
108
114
        self.protocol.receive()
131
137
                extras='date_upload,owner_name,icon_server,geo',
132
138
                format='json',
133
139
                nojsoncallback='1',
134
 
                api_key='fake',
 
140
                api_key='consume',
135
141
                method='flickr.photos.getContactsPhotos',
136
142
                ),
137
143
            headers={})