@patch.multiple('gevent', spawn=DEFAULT, joinall=DEFAULT)
@patch.multiple('failnozzle.server', pager=DEFAULT, mailer=DEFAULT)
def test_flusher_rate_excede(spawn, joinall, pager, mailer):
    template_dir = os.path.join(os.path.dirname(__file__), '..')

    pager_window = 5
    pager_limit = 10

    message_rate = MessageRate(pager_window, pager_limit)

    spawn_ret_val = object()
    spawn.return_value = spawn_ret_val

    env = Environment(loader=FileSystemLoader(template_dir))
    message_buffer = MessageBuffer(env.get_template('subject-template.txt'),
                                   env.get_template('body-template.txt'))

    for i in range(pager_limit + 1):
        message_buffer.add(UniqueMessage('module', 'funcName', 'filename',
                                         'message', 'pathname', i,
                                         'exc_text', 'kind'),
                           'source')

    flusher(message_buffer, message_rate)
    eq_([call(pager, pager_limit + 1),
         call(mailer, ANY, ANY, ANY)],
        spawn.call_args_list)

    # We shouldn't have done anything
    eq_(2, spawn.call_count)
    eq_(1, joinall.call_count)
    joinall.assert_called_once_with([spawn_ret_val] * 2)
Ensures that a Model subclass contains a default manager  and sets the
dataset/ETHPy150Open wingu/failnozzle/failnozzle/tests/test_server.py/test_flusher_rate_excede--crossover with--dataset/ETHPy150Open django/django/django/db/models/manager.py/ensure_default_manager