-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🏥 Source Gitlab: increase test coverage, update Groups, Commits and P…
…rojects schemas. (#33676)
- Loading branch information
1 parent
2edcfb3
commit 804a7bf
Showing
15 changed files
with
271 additions
and
93 deletions.
There are no files selected for viewing
34 changes: 17 additions & 17 deletions
34
airbyte-integrations/connectors/source-gitlab/integration_tests/expected_records.jsonl
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 17 additions & 17 deletions
34
...e-integrations/connectors/source-gitlab/integration_tests/expected_records_with_ids.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
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
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
1 change: 1 addition & 0 deletions
1
airbyte-integrations/connectors/source-gitlab/unit_tests/test_config.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "groups": "a b c", "groups_list": ["a", "c", "b"] } |
21 changes: 21 additions & 0 deletions
21
airbyte-integrations/connectors/source-gitlab/unit_tests/test_config_migrations.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,21 @@ | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
|
||
import os | ||
|
||
from source_gitlab.config_migrations import MigrateGroups | ||
from source_gitlab.source import SourceGitlab | ||
|
||
TEST_CONFIG_PATH = f"{os.path.dirname(__file__)}/test_config.json" | ||
|
||
|
||
def test_should_migrate(): | ||
assert MigrateGroups._should_migrate({"groups": "group group2 group3"}) is True | ||
assert MigrateGroups._should_migrate({"groups_list": ["test", "group2", "group3"]}) is False | ||
|
||
|
||
def test__modify_and_save(): | ||
source = SourceGitlab() | ||
expected = {"groups": "a b c", "groups_list": ["b", "c", "a"]} | ||
modified_config = MigrateGroups._modify_and_save(config_path=TEST_CONFIG_PATH, source=source, config={"groups": "a b c"}) | ||
assert modified_config["groups_list"].sort() == expected["groups_list"].sort() | ||
assert modified_config.get("groups") |
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
17 changes: 17 additions & 0 deletions
17
airbyte-integrations/connectors/source-gitlab/unit_tests/test_utils.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,17 @@ | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
|
||
import pytest | ||
from source_gitlab.utils import parse_url | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"url, expected", | ||
( | ||
("http://example.com", (True, "http", "example.com")), | ||
("http://example", (True, "http", "example")), | ||
("test://example.com", (False, "", "")), | ||
("https://example.com/test/test2", (False, "", "")), | ||
) | ||
) | ||
def test_parse_url(url, expected): | ||
assert parse_url(url) == expected |
Oops, something went wrong.