예제 #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')
예제 #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')
예제 #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')
예제 #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')
예제 #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
예제 #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
예제 #7
0
def test_auth_no_authconfig(ctx, client):
    app, test = client
    del app.config['JSONDASH']['auth']
    assert charts_builder.auth()
예제 #8
0
def test_auth_no_authconfig(ctx, client):
    app, test = client
    del app.config['JSONDASH']['auth']
    assert charts_builder.auth()