示例#1
0
def test_secret_client():
    secret = 'test-secret'
    auth = SecretClientAuth(secret=secret)
    assert auth.get_headers() == { 'intake-secret': secret}

    auth = SecretClientAuth(secret=secret, key='another_header')
    assert auth.get_headers() == { 'another_header': secret}
示例#2
0
def test_secret_auth(intake_server_with_auth):
    auth = SecretClientAuth(secret='test_secret')
    catalog = open_catalog(intake_server_with_auth, auth=auth)

    entries = list(catalog)
    assert entries == ['example']

    catalog.example.read()
示例#3
0
def test_secret_client():
    secret = 'test-secret'
    auth = SecretClientAuth(secret=secret)
    assert auth.get_headers() == { 'intake-secret': secret}

    auth = SecretClientAuth(secret=secret, key='another_header')
    assert auth.get_headers() == { 'another_header': secret}
示例#4
0
def test_secret_auth_fail(intake_server_with_auth):
    auth = SecretClientAuth(secret='test_wrong_secret')
    with pytest.raises(AuthenticationFailure):
        open_catalog(intake_server_with_auth, auth=auth)
示例#5
0
def test_secret_auth_fail(intake_server_with_auth):
    auth = SecretClientAuth(secret='test_wrong_secret')
    with pytest.raises(Exception):
        catalog = Catalog(intake_server_with_auth, auth=auth)
示例#6
0
def test_secret_auth(intake_server_with_auth):
    auth = SecretClientAuth(secret='test_secret')
    catalog = Catalog(intake_server_with_auth, auth=auth)

    entries = list(catalog)
    assert entries == ['use_example1']