1
0
mirror of synced 2026-01-25 10:01:49 -05:00
Files
airbyte/airbyte-integrations/connectors/source-sentry/unit_tests/test_source.py
Brian Lai 184f192bca Revert Sendgrid and Sentry sources to use python CDK instead of low-code (#16112)
* Revert Sendgrid and Sentry sources to use python CDK instead of low-code

* keep yaml configs for future reference

* don't revert additional properties and update changelog w/ PR number

* consistent time formatting in Messages stream and fix the unit test

* auto-bump connector version [ci skip]

* auto-bump connector version [ci skip]

Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
2022-08-30 17:07:08 -04:00

34 lines
1.1 KiB
Python

#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
from unittest.mock import MagicMock
from airbyte_cdk.logger import AirbyteLogger
from source_sentry.source import SourceSentry
from source_sentry.streams import Projects
def test_source_wrong_credentials():
source = SourceSentry()
status, error = source.check_connection(logger=AirbyteLogger(), config={"auth_token": "test_auth_token"})
assert not status
def test_check_connection(mocker):
source = SourceSentry()
logger_mock, config_mock = MagicMock(), MagicMock()
mocker.patch.object(Projects, "read_records", return_value=iter([{"id": "1", "name": "test"}]))
assert source.check_connection(logger_mock, config_mock) == (True, None)
def test_streams(mocker):
source = SourceSentry()
config_mock = MagicMock()
config_mock["auth_token"] = "test-token"
config_mock["organization"] = "test-organization"
config_mock["project"] = "test-project"
streams = source.streams(config_mock)
expected_streams_number = 4
assert len(streams) == expected_streams_number