Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(7)  |  Derive(0)  |  Import(0)
Contains a mapping of available limits.  To compact a bucket, the
bucket needs to be loaded; this needs to be done by reference to
the limit class, as the limit class specifies the bucket class to
use and performs the appropriate processing of update records in
the bucket list.

Much of the code here is actually copied from the
TurnstileMiddleware, suggesting that further abstraction is
necessary.

src/t/u/turnstile-HEAD/tests/unit/test_compactor.py   turnstile(Download)
    def test_init_local(self, mock_RemoteControlDaemon, mock_ControlDaemon):
        conf = config.Config(conf_dict={})
 
        lc = compactor.LimitContainer(conf, 'db')
 
    def test_init_remote(self, mock_RemoteControlDaemon, mock_ControlDaemon):
        conf = config.Config(conf_dict={'control.remote': 'yes'})
 
        lc = compactor.LimitContainer(conf, 'db')
 
    def test_getitem(self, mock_recheck_limits, mock_ControlDaemon):
        lc = compactor.LimitContainer(config.Config(), 'db')
        lc.limit_map = dict(uuid1='limit1', uuid2='limit2')
 
        self.assertEqual(lc['uuid1'], 'limit1')
            'get_limits.return_value': limit_data,
        })
        lc = compactor.LimitContainer(config.Config(), mock.Mock())
        lc.limits = [mock.Mock(uuid='old_uuid1'), mock.Mock(uuid='old_uuid2')]
        lc.limit_sum = 'old_sum'
            'get_limits.return_value': limit_data,
        })
        lc = compactor.LimitContainer(config.Config(), mock.Mock())
        old_limits = [mock.Mock(uuid='old_uuid1'), mock.Mock(uuid='old_uuid2')]
        lc.limits = old_limits