-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source Confluence: certificate to Beta #23988
Merged
darynaishchenko
merged 7 commits into
master
from
daryna/source-confluence/update-to-beta
Mar 22, 2023
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5a9bd6d
added view and storage to pages, updated SAT
darynaishchenko a2c5253
added unittests
darynaishchenko e8800b9
added changelog, fixed type in docs
darynaishchenko b56d236
Merge branch 'master' into daryna/source-confluence/update-to-beta
darynaishchenko e92bd86
added checking for stream Audit to skip it if user doesn't have permi…
darynaishchenko 519cc01
refactored plan validation
darynaishchenko 8b961c0
auto-bump connector version
octavia-squidington-iii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
airbyte-integrations/connectors/source-confluence/acceptance-test-config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
# See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) | ||
# for more information about how to configure these tests | ||
connector_image: airbyte/source-confluence:dev | ||
tests: | ||
acceptance_tests: | ||
spec: | ||
tests: | ||
- spec_path: "source_confluence/spec.json" | ||
connection: | ||
tests: | ||
- config_path: "secrets/config.json" | ||
status: "succeed" | ||
- config_path: "integration_tests/invalid_config.json" | ||
status: "failed" | ||
discovery: | ||
tests: | ||
- config_path: "secrets/config.json" | ||
basic_read: | ||
tests: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" | ||
empty_streams: [] | ||
expect_records: | ||
path: "integration_tests/expected_records.jsonl" | ||
full_refresh: | ||
tests: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" | ||
ignored_fields: | ||
pages: | ||
- name: "body/view" |
10 changes: 10 additions & 0 deletions
10
airbyte-integrations/connectors/source-confluence/integration_tests/configured_catalog.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
airbyte-integrations/connectors/source-confluence/integration_tests/expected_records.jsonl
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
airbyte-integrations/connectors/source-confluence/unit_tests/test_streams.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
from unittest.mock import MagicMock | ||
|
||
import pytest | ||
import requests | ||
from source_confluence.source import Audit, BaseContentStream, BlogPosts, ConfluenceStream, Group, Pages, Space | ||
|
||
|
||
class TestsConfluenceStream: | ||
confluence_stream_class = ConfluenceStream({"authenticator": MagicMock(), "domain_name": "test"}) | ||
|
||
def tests_url_base(self): | ||
assert self.confluence_stream_class.url_base == "https://test/wiki/rest/api/" | ||
|
||
def test_primary_key(self): | ||
assert self.confluence_stream_class.primary_key == "id" | ||
|
||
def test_limit(self): | ||
assert self.confluence_stream_class.limit == 50 | ||
|
||
def test_start(self): | ||
assert self.confluence_stream_class.start == 0 | ||
|
||
def test_expand(self): | ||
assert self.confluence_stream_class.expand == [] | ||
|
||
def test_next_page_token(self, requests_mock): | ||
url = "https://test.atlassian.net/wiki/rest/api/space" | ||
requests_mock.get(url, status_code=200, json={"_links": {"next": "test link"}}) | ||
response = requests.get(url) | ||
assert self.confluence_stream_class.next_page_token(response=response) == {"start": 50} | ||
|
||
@pytest.mark.parametrize( | ||
("stream_state", "stream_slice", "next_page_token", "expected"), | ||
[ | ||
({}, {}, {}, {'limit': 50, 'expand': ''}), | ||
], | ||
) | ||
def test_request_params(self, stream_state, stream_slice, next_page_token, expected): | ||
assert self.confluence_stream_class.request_params(stream_state, stream_slice, next_page_token) == expected | ||
|
||
def test_parse_response(self, requests_mock): | ||
url = "https://test.atlassian.net/wiki/rest/api/space" | ||
requests_mock.get(url, status_code=200, json={"results": ["test", "test1", "test3"]}) | ||
response = requests.get(url) | ||
assert list(self.confluence_stream_class.parse_response(response=response)) == ['test', 'test1', 'test3'] | ||
|
||
|
||
class TestBaseContentStream: | ||
base_content_stream_class = BaseContentStream({"authenticator": MagicMock(), "domain_name": "test"}) | ||
|
||
def test_path(self): | ||
assert self.base_content_stream_class.path({}, {}, {}) == "content" | ||
|
||
def test_expand(self): | ||
assert self.base_content_stream_class.expand == ["history", | ||
"history.lastUpdated", | ||
"history.previousVersion", | ||
"history.contributors", | ||
"restrictions.read.restrictions.user", | ||
"version", | ||
"descendants.comment", | ||
"body", | ||
"body.storage", | ||
"body.view", | ||
] | ||
|
||
def test_limit(self): | ||
assert self.base_content_stream_class.limit == 25 | ||
|
||
def test_content_type(self): | ||
assert self.base_content_stream_class.content_type is None | ||
|
||
@pytest.mark.parametrize( | ||
("stream_state", "stream_slice", "next_page_token", "expected"), | ||
[ | ||
({}, {}, {}, {'limit': 25, | ||
'expand': 'history,history.lastUpdated,history.previousVersion,history.contributors,restrictions.' | ||
'read.restrictions.user,version,descendants.comment,body,body.storage,body.view', | ||
'type': None}), | ||
], | ||
) | ||
def test_request_params(self, stream_state, stream_slice, next_page_token, expected): | ||
assert self.base_content_stream_class.request_params(stream_state, stream_slice, next_page_token) == expected | ||
|
||
|
||
class TestPages: | ||
pages_class = Pages({"authenticator": MagicMock(), "domain_name": "test"}) | ||
|
||
def test_content_type(self): | ||
assert self.pages_class.content_type == "page" | ||
|
||
|
||
class TestBlogPosts: | ||
blog_posts_class = BlogPosts({"authenticator": MagicMock(), "domain_name": "test"}) | ||
|
||
def test_content_type(self): | ||
assert self.blog_posts_class.content_type == "blogpost" | ||
|
||
|
||
class TestSpace: | ||
space_class = Space({"authenticator": MagicMock(), "domain_name": "test"}) | ||
|
||
def test_api_name(self): | ||
assert self.space_class.api_name == "space" | ||
|
||
def test_expand(self): | ||
assert self.space_class.expand == ["permissions", "icon", "description.plain", "description.view"] | ||
|
||
|
||
class TestGroup: | ||
group_class = Group({"authenticator": MagicMock(), "domain_name": "test"}) | ||
|
||
def test_api_name(self): | ||
assert self.group_class.api_name == "group" | ||
|
||
|
||
class TestAudit: | ||
audit_class = Audit({"authenticator": MagicMock(), "domain_name": "test"}) | ||
|
||
def test_api_name(self): | ||
assert self.audit_class.api_name == "audit" | ||
|
||
def test_primary_key(self): | ||
assert self.audit_class.primary_key == "author" | ||
|
||
def test_limit(self): | ||
assert self.audit_class.limit == 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above described more pythonic way to Audit validation. But better way is add validation method what return bool value and depend on that we will add Audit stream to our streams list.
P-Code: