-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔴 having a user mismatch between user and url does not cause an error
- Loading branch information
1 parent
5e36d7b
commit 3765e2b
Showing
2 changed files
with
33 additions
and
14 deletions.
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
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,33 @@ | ||
import pytest | ||
|
||
from frictionless import FrictionlessException | ||
from frictionless.portals.github.plugin import GithubControl, GithubPlugin | ||
|
||
|
||
def test_github_plugin_parse_repo(): | ||
test_cases = [ | ||
{"url": "https://github.com/user/some-repo"}, | ||
{"url": "https://github.com/user/some-repo/some-other-stuff"}, | ||
{ | ||
"url": "https://github.com/user/some-repo/some-stuff", | ||
"control": GithubControl(user="user", repo="some-repo"), | ||
}, | ||
] | ||
|
||
plugin = GithubPlugin() | ||
for test_case in test_cases: | ||
control = test_case["control"] if "control" in test_case else None | ||
|
||
adapter = plugin.create_adapter(source=test_case["url"], control=control) | ||
|
||
assert adapter.control.user == "user" | ||
assert adapter.control.repo == "some-repo" | ||
|
||
|
||
def test_github_url_control_mismatch(): | ||
url = "https://github.com/user/some-repo" | ||
control = GithubControl(user="wrong-user") | ||
|
||
plugin = GithubPlugin() | ||
with pytest.raises(FrictionlessException): | ||
plugin.create_adapter(source=url, control=control) |