-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utils/path.py - fix
GIT_REPO_REGEX
and calc_repo_path
- Loading branch information
1 parent
cfe01c6
commit 30226b3
Showing
3 changed files
with
24 additions
and
4 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Place of record for the package version""" | ||
|
||
__version__ = "0.9.30" | ||
__version__ = "0.9.31" | ||
__git_hash__ = "GIT_HASH" |
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
"""Test path utilities""" | ||
import os | ||
from unittest import TestCase | ||
from unittest.mock import patch, MagicMock | ||
|
||
from networkx import DiGraph | ||
|
||
from terrawrap.utils.path import get_file_graph | ||
from terrawrap.utils.path import get_file_graph, calc_repo_path | ||
|
||
|
||
class TestPath(TestCase): | ||
|
@@ -64,3 +65,22 @@ def test_get_file_graph(self): | |
) | ||
self.assertEqual(set(actual.nodes), set(expected.nodes)) | ||
self.assertEqual(set(actual.edges), set(expected.edges)) | ||
|
||
@patch("terrawrap.utils.path.subprocess.check_output") | ||
def test_calc_repo_path(self, check_output_mock: MagicMock): | ||
"""test getting repo path based on repo remote""" | ||
check_output_mock.return_value = b"[email protected]:amplify-education/repo-1.git" | ||
result = calc_repo_path("path/config") | ||
self.assertEqual(result, "repo-1/config") | ||
|
||
check_output_mock.return_value = ( | ||
b"https://github.com/amplify-education/repo-2.git" | ||
) | ||
result = calc_repo_path("path/config") | ||
self.assertEqual(result, "repo-2/config") | ||
|
||
check_output_mock.return_value = ( | ||
b"Fetch URL: https://github.com/amplify-education/repo-3.git" | ||
) | ||
result = calc_repo_path("path/config") | ||
self.assertEqual(result, "repo-3/config") |