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}
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()
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)
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)
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']