1
0
mirror of synced 2025-12-30 21:02:43 -05:00
Files
airbyte/airbyte-integrations/connectors/source-github/unit_tests/unit_test.py
Roman Yermilov [GL] ce9eb8ab4c Source Github: better error explanation for 401 (#26025)
* Source Github: better error explanation for 401

* Source Github: bump version, update changelog

* Source Github: fix test name

* Source Github: fix unittests

* Source Github: bump version

* auto-bump connector version

---------

Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
2023-05-16 22:35:22 +04:00

23 lines
912 B
Python

#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from airbyte_cdk.sources.streams.http.auth import MultipleTokenAuthenticator
from source_github import SourceGithub
def test_single_token():
authenticator = SourceGithub()._get_authenticator({"access_token": "123"})
assert isinstance(authenticator, MultipleTokenAuthenticator)
assert ["123"] == authenticator._tokens
authenticator = SourceGithub()._get_authenticator({"credentials": {"access_token": "123"}})
assert ["123"] == authenticator._tokens
authenticator = SourceGithub()._get_authenticator({"credentials": {"personal_access_token": "123"}})
assert ["123"] == authenticator._tokens
def test_multiple_tokens():
authenticator = SourceGithub()._get_authenticator({"access_token": "123, 456"})
assert isinstance(authenticator, MultipleTokenAuthenticator)
assert ["123", "456"] == authenticator._tokens