airbyte-source-github 1.6.0__py3-none-any.whl → 1.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_source_github-1.6.2.dist-info/METADATA +111 -0
- {airbyte_source_github-1.6.0.dist-info → airbyte_source_github-1.6.2.dist-info}/RECORD +17 -43
- {airbyte_source_github-1.6.0.dist-info → airbyte_source_github-1.6.2.dist-info}/WHEEL +1 -2
- airbyte_source_github-1.6.2.dist-info/entry_points.txt +3 -0
- airbyte_source_github-1.6.0.dist-info/METADATA +0 -144
- airbyte_source_github-1.6.0.dist-info/entry_points.txt +0 -2
- airbyte_source_github-1.6.0.dist-info/top_level.txt +0 -3
- integration_tests/__init__.py +0 -0
- integration_tests/abnormal_state.json +0 -237
- integration_tests/acceptance.py +0 -16
- integration_tests/configured_catalog.json +0 -435
- integration_tests/configured_catalog_full_refresh_test.json +0 -415
- integration_tests/invalid_config.json +0 -5
- integration_tests/sample_config.json +0 -5
- integration_tests/sample_state.json +0 -137
- unit_tests/__init__.py +0 -3
- unit_tests/conftest.py +0 -29
- unit_tests/projects_v2_pull_requests_query.json +0 -3
- unit_tests/pull_request_stats_query.json +0 -3
- unit_tests/responses/contributor_activity_response.json +0 -33
- unit_tests/responses/graphql_reviews_responses.json +0 -405
- unit_tests/responses/issue_timeline_events.json +0 -166
- unit_tests/responses/issue_timeline_events_response.json +0 -170
- unit_tests/responses/projects_v2_response.json +0 -45
- unit_tests/responses/pull_request_comment_reactions.json +0 -744
- unit_tests/responses/pull_request_stats_response.json +0 -317
- unit_tests/test_migrations/test_config.json +0 -8
- unit_tests/test_migrations/test_new_config.json +0 -8
- unit_tests/test_multiple_token_authenticator.py +0 -163
- unit_tests/test_source.py +0 -331
- unit_tests/test_stream.py +0 -1471
- unit_tests/utils.py +0 -78
unit_tests/utils.py
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
from typing import Any, MutableMapping
|
6
|
-
from unittest import mock
|
7
|
-
|
8
|
-
import responses
|
9
|
-
from airbyte_cdk.models import SyncMode
|
10
|
-
from airbyte_cdk.models.airbyte_protocol import ConnectorSpecification
|
11
|
-
from airbyte_cdk.sources import Source
|
12
|
-
from airbyte_cdk.sources.streams import Stream
|
13
|
-
from airbyte_cdk.sources.utils.schema_helpers import check_config_against_spec_or_exit, split_config
|
14
|
-
|
15
|
-
|
16
|
-
def read_incremental(stream_instance: Stream, stream_state: MutableMapping[str, Any]):
|
17
|
-
res = []
|
18
|
-
slices = stream_instance.stream_slices(sync_mode=SyncMode.incremental, stream_state=stream_state)
|
19
|
-
for slice in slices:
|
20
|
-
records = stream_instance.read_records(sync_mode=SyncMode.incremental, stream_slice=slice, stream_state=stream_state)
|
21
|
-
for record in records:
|
22
|
-
stream_state = stream_instance.get_updated_state(stream_state, record)
|
23
|
-
res.append(record)
|
24
|
-
return res
|
25
|
-
|
26
|
-
|
27
|
-
class ProjectsResponsesAPI:
|
28
|
-
"""
|
29
|
-
Fake Responses API for github projects, columns, cards
|
30
|
-
"""
|
31
|
-
|
32
|
-
projects_url = "https://api.github.com/repos/organization/repository/projects"
|
33
|
-
columns_url = "https://api.github.com/projects/{project_id}/columns"
|
34
|
-
cards_url = "https://api.github.com/projects/columns/{column_id}/cards"
|
35
|
-
|
36
|
-
@classmethod
|
37
|
-
def get_json_projects(cls, data):
|
38
|
-
res = []
|
39
|
-
for n, project in enumerate(data, start=1):
|
40
|
-
name = f"project_{n}"
|
41
|
-
res.append({"id": n, "name": name, "updated_at": project["updated_at"]})
|
42
|
-
return res
|
43
|
-
|
44
|
-
@classmethod
|
45
|
-
def get_json_columns(cls, project, project_id):
|
46
|
-
res = []
|
47
|
-
for n, column in enumerate(project.get("columns", []), start=1):
|
48
|
-
column_id = int(str(project_id) + str(n))
|
49
|
-
name = f"column_{column_id}"
|
50
|
-
res.append({"id": column_id, "name": name, "updated_at": column["updated_at"]})
|
51
|
-
return res
|
52
|
-
|
53
|
-
@classmethod
|
54
|
-
def get_json_cards(cls, column, column_id):
|
55
|
-
res = []
|
56
|
-
for n, card in enumerate(column.get("cards", []), start=1):
|
57
|
-
card_id = int(str(column_id) + str(n))
|
58
|
-
name = f"card_{card_id}"
|
59
|
-
res.append({"id": card_id, "name": name, "updated_at": card["updated_at"]})
|
60
|
-
return res
|
61
|
-
|
62
|
-
@classmethod
|
63
|
-
def register(cls, data):
|
64
|
-
responses.upsert("GET", cls.projects_url, json=cls.get_json_projects(data))
|
65
|
-
for project_id, project in enumerate(data, start=1):
|
66
|
-
responses.upsert("GET", cls.columns_url.format(project_id=project_id), json=cls.get_json_columns(project, project_id))
|
67
|
-
for n, column in enumerate(project.get("columns", []), start=1):
|
68
|
-
column_id = int(str(project_id) + str(n))
|
69
|
-
responses.upsert("GET", cls.cards_url.format(column_id=column_id), json=cls.get_json_cards(column, column_id))
|
70
|
-
|
71
|
-
|
72
|
-
def command_check(source: Source, config):
|
73
|
-
logger = mock.MagicMock()
|
74
|
-
connector_config, _ = split_config(config)
|
75
|
-
if source.check_config_against_spec:
|
76
|
-
source_spec: ConnectorSpecification = source.spec(logger)
|
77
|
-
check_config_against_spec_or_exit(connector_config, source_spec)
|
78
|
-
return source.check(logger, config)
|