Beispiel #1
0
def test_help(dev_server):
    client = Vault(dev_server.addr, token=dev_server.root_token)

    response = yield from client.read('/sys/auth/github',
                                      params={"help": 1})
    data = yield from response.json()
    assert 'help' in data
Beispiel #2
0
def test_renew(dev_server):
    client = Vault(dev_server.addr, token=dev_server.root_token)
    response = yield from client.write('/secret/foo', json={
        'data': 'bar', 'lease': '1h'
    })
    assert response.status == 204

    response = yield from client.read('/secret/foo')
    result = yield from response.json()
    renewed = yield from client.lease.renew(result['lease_id'])
    assert renewed
Beispiel #3
0
def test_github_raw_loading(dev_server):
    client = Vault(dev_server.addr, token=dev_server.root_token)

    response = yield from client.read('/sys/auth/github/login',
                                      params={"help": 1})
    data = yield from response.json()
    print(data['help'])

    # low level create/delete

    response = yield from client.write('/sys/auth/github',
                                       json={"type": "github"})
    assert response.status == 204, 'Must add github auth backend'
    response = yield from client.delete('/sys/auth/github')
    assert response.status == 204, 'Must delete github auth backend'

    # high level create/delete

    response = yield from client.auth.enable('github')
    assert response.type == 'github', 'Must add github auth backend'
    response = yield from client.auth.disable('github')
    assert response is True, 'Must delete github auth backend'
Beispiel #4
0
def test_github_raw_loading(dev_server):
    client = Vault(dev_server.addr, token=dev_server.root_token)

    response = yield from client.read('/sys/auth/github/login',
                                      params={"help": 1})
    data = yield from response.json()
    print(data['help'])

    # low level create/delete

    response = yield from client.write('/sys/auth/github',
                                       json={"type": "github"})
    assert response.status == 204, 'Must add github auth backend'
    response = yield from client.delete('/sys/auth/github')
    assert response.status == 204, 'Must delete github auth backend'

    # high level create/delete

    response = yield from client.auth.enable('github')
    assert response.type == 'github', 'Must add github auth backend'
    response = yield from client.auth.disable('github')
    assert response is True, 'Must delete github auth backend'
Beispiel #5
0
def test_help(dev_server):
    client = Vault(dev_server.addr, token=dev_server.root_token)

    response = yield from client.read('/sys/auth/github', params={"help": 1})
    data = yield from response.json()
    assert 'help' in data