mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 09:56:05 -05:00
[Downloader] Parse tree URLs when cloning repos (#2119)
* [Downloader] Parse tree URLs when cloning repos Signed-off-by: Toby <tobyharradine@gmail.com> * Only match GitHub and GitLab URLs Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
@@ -94,3 +94,27 @@ async def test_existing_repo(repo_manager):
|
||||
await repo_manager.add_repo("http://test.com", "test")
|
||||
|
||||
repo_manager.does_repo_exist.assert_called_once_with("test")
|
||||
|
||||
|
||||
def test_tree_url_parse(repo_manager):
|
||||
cases = [
|
||||
{
|
||||
"input": ("https://github.com/Tobotimus/Tobo-Cogs", None),
|
||||
"expected": ("https://github.com/Tobotimus/Tobo-Cogs", None),
|
||||
},
|
||||
{
|
||||
"input": ("https://github.com/Tobotimus/Tobo-Cogs", "V3"),
|
||||
"expected": ("https://github.com/Tobotimus/Tobo-Cogs", "V3"),
|
||||
},
|
||||
{
|
||||
"input": ("https://github.com/Tobotimus/Tobo-Cogs/tree/V3", None),
|
||||
"expected": ("https://github.com/Tobotimus/Tobo-Cogs", "V3"),
|
||||
},
|
||||
{
|
||||
"input": ("https://github.com/Tobotimus/Tobo-Cogs/tree/V3", "V4"),
|
||||
"expected": ("https://github.com/Tobotimus/Tobo-Cogs", "V4"),
|
||||
},
|
||||
]
|
||||
|
||||
for test_case in cases:
|
||||
assert test_case["expected"] == repo_manager._parse_url(*test_case["input"])
|
||||
|
||||
Reference in New Issue
Block a user