-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: add support for civitai url model download (#60)
* Feat: add support for civitai url model download * Add pytest workflow
- Loading branch information
Showing
5 changed files
with
145 additions
and
10 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 |
---|---|---|
|
@@ -9,4 +9,4 @@ repos: | |
hooks: | ||
- id: pylint | ||
args: | ||
- --disable=R,C,W,E0401 | ||
- --disable=R,C,W,E0401 |
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 |
---|---|---|
|
@@ -4,7 +4,9 @@ GitPython | |
requests | ||
pyyaml | ||
typing-extensions | ||
questionary | ||
mixpanel | ||
tomlkit | ||
pathspec | ||
httpx | ||
httpx | ||
packaging |
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,36 @@ | ||
from comfy_cli.command.models.models import check_civitai_url | ||
|
||
|
||
def test_valid_model_url(): | ||
url = "https://civitai.com/models/43331" | ||
assert check_civitai_url(url) == (True, False, 43331, None) | ||
|
||
|
||
def test_valid_model_url_with_version(): | ||
url = "https://civitai.com/models/43331/majicmix-realistic" | ||
assert check_civitai_url(url) == (True, False, 43331, None) | ||
|
||
|
||
def test_valid_model_url_with_query(): | ||
url = "https://civitai.com/models/43331?version=12345" | ||
assert check_civitai_url(url) == (True, False, 43331, 12345) | ||
|
||
|
||
def test_valid_api_url(): | ||
url = "https://civitai.com/api/download/models/67890" | ||
assert check_civitai_url(url) == (False, True, None, 67890) | ||
|
||
|
||
def test_invalid_url(): | ||
url = "https://example.com/models/43331" | ||
assert check_civitai_url(url) == (False, False, None, None) | ||
|
||
|
||
def test_malformed_url(): | ||
url = "https://civitai.com/models/" | ||
assert check_civitai_url(url) == (False, False, None, None) | ||
|
||
|
||
def test_malformed_query_url(): | ||
url = "https://civitai.com/models/43331?version=" | ||
assert check_civitai_url(url) == (False, False, None, None) |