Ejemplo n.º 1
0
def test_auth_false_realauth(ctx, client):
    app, test = client
    assert not charts_builder.auth(authtype='create')
    assert not charts_builder.auth(authtype='view')
    assert not charts_builder.auth(authtype='delete')
    assert not charts_builder.auth(authtype='clone')
    assert not charts_builder.auth(authtype='edit_global')
    assert not charts_builder.auth(authtype='edit_others')
Ejemplo n.º 2
0
def test_auth_false_realauth(ctx, client):
    app, test = client
    assert not charts_builder.auth(authtype='create')
    assert not charts_builder.auth(authtype='view')
    assert not charts_builder.auth(authtype='delete')
    assert not charts_builder.auth(authtype='clone')
    assert not charts_builder.auth(authtype='edit_global')
    assert not charts_builder.auth(authtype='edit_others')
Ejemplo n.º 3
0
def test_auth_true_realauth(ctx, client):
    app, test = client
    def authfunc(*args):
        return True

    app.config['JSONDASH']['auth'] = dict(
        clone=authfunc,
        edit_global=authfunc,
        create=authfunc,
        delete=authfunc,
        view=authfunc,
    )
    assert charts_builder.auth(authtype='create')
    assert charts_builder.auth(authtype='view')
    assert charts_builder.auth(authtype='delete')
    assert charts_builder.auth(authtype='clone')
    assert charts_builder.auth(authtype='edit_global')
    assert charts_builder.auth(authtype='edit_others')
Ejemplo n.º 4
0
def test_auth_true_realauth(ctx, client):
    app, test = client

    def authfunc(*args):
        return True

    app.config['JSONDASH']['auth'] = dict(
        clone=authfunc,
        edit_global=authfunc,
        create=authfunc,
        delete=authfunc,
        view=authfunc,
    )
    assert charts_builder.auth(authtype='create')
    assert charts_builder.auth(authtype='view')
    assert charts_builder.auth(authtype='delete')
    assert charts_builder.auth(authtype='clone')
    assert charts_builder.auth(authtype='edit_global')
    assert charts_builder.auth(authtype='edit_others')
Ejemplo n.º 5
0
def test_auth_true_fakeauth(ctx, client):
    app, test = client
    assert charts_builder.auth(authtype=None)
    assert charts_builder.auth(authtype='foo')
    assert charts_builder.metadata(key='foo') is None
Ejemplo n.º 6
0
def test_auth_true_fakeauth(ctx, client):
    app, test = client
    assert charts_builder.auth(authtype=None)
    assert charts_builder.auth(authtype='foo')
    assert charts_builder.metadata(key='foo') is None
Ejemplo n.º 7
0
def test_auth_no_authconfig(ctx, client):
    app, test = client
    del app.config['JSONDASH']['auth']
    assert charts_builder.auth()
Ejemplo n.º 8
0
def test_auth_no_authconfig(ctx, client):
    app, test = client
    del app.config['JSONDASH']['auth']
    assert charts_builder.auth()