Add support for Gitea and Forgejo in token handling
- Enhanced the `with_token` function to support Gitea and Forgejo URLs by constructing the appropriate authentication format for generic HTTPS. - Updated tests to validate the new functionality, ensuring correct token injection for Gitea URLs while maintaining existing behavior for GitHub and GitLab. - Improved overall robustness of token handling across different platforms.
This commit is contained in:
@@ -55,6 +55,10 @@ def test_git_token_injection():
|
||||
url = "https://github.com/org/Ext.git"
|
||||
assert "x-access-token:secret@" in with_token(url, "secret")
|
||||
assert strip_auth(with_token(url, "secret")) == url
|
||||
gitea = "https://gitea.hsrv.site/mrleo1nid/swarm-assistent.git"
|
||||
authed = with_token(gitea, "secret")
|
||||
assert "oauth2:secret@gitea.hsrv.site" in authed
|
||||
assert strip_auth(authed) == gitea
|
||||
assert is_sha("a" * 40)
|
||||
assert not is_sha("main")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user