Exemplo n.º 1
0
def test_preload_no_ini():
    from pyramid_celery import on_preload_parsed

    options = {"ini": None, "ini_var": None}

    with pytest.raises(SystemExit):
        on_preload_parsed(options)
Exemplo n.º 2
0
def test_preload_ini():
    from pyramid_celery import on_preload_parsed

    options = {"ini": "tests/configs/dev.ini", "ini_var": None}

    with mock.patch("pyramid_celery.bootstrap") as boot:
        on_preload_parsed(options)
        assert boot.called_with("dev.ini")
Exemplo n.º 3
0
def test_preload_no_ini():
    from pyramid_celery import on_preload_parsed
    options = {
        'ini': None,
        'ini_var': None,
    }

    with pytest.raises(SystemExit):
        on_preload_parsed(options)
Exemplo n.º 4
0
def test_preload_with_ini_vars():
    from pyramid_celery import on_preload_parsed

    options = {"ini": "tests/configs/dev.ini", "ini_var": "database=foo,password=bar"}

    with mock.patch("pyramid_celery.bootstrap") as boot:
        on_preload_parsed(options)
        expected_vars = {"database": "foo", "password": "******"}
        assert boot.called_with("dev.ini", expected_vars)
Exemplo n.º 5
0
def test_preload_ini():
    from pyramid_celery import on_preload_parsed
    options = {
        'ini': 'tests/configs/dev.ini',
        'ini_var': None,
    }

    with mock.patch('pyramid_celery.bootstrap') as boot:
        on_preload_parsed(options)
        assert boot.called_with('dev.ini')
Exemplo n.º 6
0
def test_preload_ini():
    from pyramid_celery import on_preload_parsed
    options = {
        'ini': 'tests/configs/dev.ini',
        'ini_var': None,
    }

    with mock.patch('pyramid_celery.bootstrap') as boot:
        on_preload_parsed(options)
        assert boot.called_with('dev.ini')
Exemplo n.º 7
0
def test_preload_with_ini_vars():
    from pyramid_celery import on_preload_parsed
    options = {
        'ini': 'tests/configs/dev.ini',
        'ini_var': 'database=foo,password=bar',
    }

    with mock.patch('pyramid_celery.bootstrap') as boot:
        on_preload_parsed(options)
        expected_vars = {'database': 'foo', 'password': '******'}
        assert boot.called_with('dev.ini', expected_vars)
Exemplo n.º 8
0
def test_preload_with_ini_vars():
    from pyramid_celery import on_preload_parsed
    options = {
        'ini': 'tests/configs/dev.ini',
        'ini_var': 'database=foo,password=bar',
    }

    with mock.patch('pyramid_celery.bootstrap') as boot:
        on_preload_parsed(options)
        expected_vars = {'database': 'foo', 'password': '******'}
        assert boot.called_with('dev.ini', expected_vars)