-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] Correctly handle URLs for self-managed gitlab (#25)
Fixes #24
- Loading branch information
1 parent
0948627
commit 87549e0
Showing
2 changed files
with
41 additions
and
6 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,27 @@ | ||
from unittest import TestCase | ||
from unittest.mock import Mock | ||
|
||
from gitlab_submodule.submodule_to_project import \ | ||
_submodule_url_to_path_with_namespace | ||
|
||
|
||
class TestSubmoduleToProject(TestCase): | ||
def test__submodule_url_to_path_with_namespace(self): | ||
# Normal gitlab host | ||
path_with_namespace = _submodule_url_to_path_with_namespace( | ||
'https://gitlab.com/namespace/repo.git', | ||
Mock()) | ||
self.assertEqual(path_with_namespace, 'namespace/repo') | ||
|
||
# Self-managed gitlab URL without self_managed_gitlab_host | ||
path_with_namespace = _submodule_url_to_path_with_namespace( | ||
'https://custom-gitlab/namespace/repo.git', | ||
Mock()) | ||
self.assertEqual(path_with_namespace, None) | ||
|
||
# Self-managed gitlab URL with self_managed_gitlab_host | ||
path_with_namespace = _submodule_url_to_path_with_namespace( | ||
'https://custom-gitlab/namespace/repo.git', | ||
Mock(), | ||
self_managed_gitlab_host='custom-gitlab') | ||
self.assertEqual(path_with_namespace, 'namespace/repo') |