Revision 1b4629c6 kamaki/clients/pithos/test.py

b/kamaki/clients/pithos/test.py
175 175
    @patch('%s.set_header' % rest_pkg)
176 176
    @patch('%s.head' % rest_pkg, return_value=FR())
177 177
    def test_account_head(self, head, SH, SP):
178
        self.client.account_head()
179 178
        for params in product(
180 179
                (None, '50m3-d473'),
181 180
                (None, '50m3-07h3r-d473'),
......
197 196
                success=kwargs.pop('success', 204),
198 197
                **kwargs))
199 198

  
199
    @patch('%s.set_param' % rest_pkg)
200
    @patch('%s.set_header' % rest_pkg)
201
    @patch('%s.get' % rest_pkg, return_value=FR())
202
    def test_account_get(self, get, SH, SP):
203
        keys = ('limit', 'marker', 'format', 'shared', 'until')
204
        for params in product(
205
                (None, 42),
206
                (None, 'X'),
207
                ('json', 'xml'),
208
                (False, True),
209
                (None, '50m3-d473'),
210
                (None, '50m3-07h3r-d473'),
211
                (None, 'y37-4n7h3r-d473'),
212
                ((), ('someval',), ('v1', 'v2',)),
213
                (dict(), dict(success=200), dict(k='v', v='k'))):
214
            args, kwargs = params[-2], params[-1]
215
            params = params[:-2]
216
            self.client.account_get(*(params + args), **kwargs)
217
            self.assertEqual(SP.mock_calls[-5:],
218
                [call(keys[i], iff=X) if (
219
                    i == 3) else call(
220
                        keys[i], X, iff=X) for i, X in enumerate(params[:5])])
221
            IMS, IUS = params[5], params[6]
222
            self.assertEqual(SH.mock_calls[-2:], [
223
                call('If-Modified-Since', IMS),
224
                call('If-Unmodified-Since', IUS)])
225
            self.assertEqual(get.mock_calls[-1], call(
226
                '/%s' % self.client.account,
227
                *args,
228
                success=kwargs.pop('success', (200, 204)),
229
                **kwargs))
230

  
200 231

  
201 232
class Pithos(TestCase):
202 233

  

Also available in: Unified diff