Revision ceb84616 kamaki/clients/pithos/test.py

b/kamaki/clients/pithos/test.py
192 192
    #  Pithos+ methods that extend storage API
193 193

  
194 194
    @patch('%s.account_head' % pithos_pkg, return_value=FR())
195
    def test_get_account_info(self, SP):
195
    def test_get_account_info(self, AH):
196 196
        FR.headers = account_info
197 197
        r = self.client.get_account_info()
198 198
        self.assert_dicts_are_equal(r, account_info)
199
        self.assertEqual(SP.mock_calls[-1], call(until=None))
199
        self.assertEqual(AH.mock_calls[-1], call(until=None))
200 200
        unt = 'un71L-d473'
201 201
        r = self.client.get_account_info(until=unt)
202 202
        self.assert_dicts_are_equal(r, account_info)
203
        self.assertEqual(SP.mock_calls[-1], call(until=unt))
203
        self.assertEqual(AH.mock_calls[-1], call(until=unt))
204 204
        FR.status_code = 401
205 205
        self.assertRaises(ClientError, self.client.get_account_info)
206 206

  
207
    @patch('%s.set_header' % client_pkg)
208
    def test_replace_account_meta(self, SH):
209
        FR.status_code = 202
210
        metas = dict(k1='v1', k2='v2', k3='v3')
211
        with patch.object(C, 'perform_request', return_value=FR()):
212
            self.client.replace_account_meta(metas)
213
            self.assertEqual(self.client.http_client.url, self.url)
214
            self.assertEqual(self.client.http_client.path, '/%s' % user_id)
215
            prfx = 'X-Account-Meta-'
216
            expected = [call('%s%s' % (prfx, k), v) for k, v in metas.items()]
217
            self.assertEqual(PC.set_header.mock_calls, expected)
218

  
219 207
    @patch('%s.account_post' % pithos_pkg, return_value=FR())
220 208
    def test_del_account_meta(self, ap):
221 209
        keys = ['k1', 'k2', 'k3']

Also available in: Unified diff