def test_reserve(self, reserve_mock):
        fake_reservations = ['1', '2']
        quotas = quotas_obj.Quotas(context=self.context)

        reserve_mock.return_value = fake_reservations

        quotas.reserve(expire='expire',
                       project_id='project_id', user_id='user_id',
                       moo='cow')
        self.assertEqual(self.context, quotas._context)
        self.assertEqual(fake_reservations, quotas.reservations)
        self.assertEqual('project_id', quotas.project_id)
        self.assertEqual('user_id', quotas.user_id)
        reserve_mock.assert_called_once_with(
            self.context, expire='expire', project_id='project_id',
            user_id='user_id', moo='cow')
    def test_reserve(self):
        fake_reservations = ['1', '2']
        quotas = quotas_obj.Quotas(context=self.context)

        self.mox.StubOutWithMock(QUOTAS, 'reserve')
        QUOTAS.reserve(self.context, expire='expire',
                       project_id='project_id', user_id='user_id',
                       moo='cow').AndReturn(fake_reservations)

        self.mox.ReplayAll()
        quotas.reserve(expire='expire',
                       project_id='project_id', user_id='user_id',
                       moo='cow')
        self.assertEqual(self.context, quotas._context)
        self.assertEqual(fake_reservations, quotas.reservations)
        self.assertEqual('project_id', quotas.project_id)
        self.assertEqual('user_id', quotas.user_id)