-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Git Tag list feature changes * Improve checkout tag PR Use SVG icon Reduce code foot print Use new Alert component * Correct unit test * Explicitly dependent on `requests_unixsocket` for test * Correct toolbar unit test Co-authored-by: Chris John <chris.john@aexp.com> Co-authored-by: Frederic Collonval <fcollonval@gmail.com>
- Loading branch information
1 parent
e95e007
commit c1ffae2
Showing
11 changed files
with
428 additions
and
22 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
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,46 @@ | ||
import os | ||
from unittest.mock import Mock, call, patch | ||
|
||
import pytest | ||
import tornado | ||
|
||
from jupyterlab_git.git import Git | ||
|
||
from .testutils import FakeContentManager, ServerTest, maybe_future | ||
|
||
@pytest.mark.asyncio | ||
async def test_git_tag_success(): | ||
with patch("jupyterlab_git.git.execute") as mock_execute: | ||
tag = "1.0.0" | ||
# Given | ||
mock_execute.return_value = maybe_future((0, tag, "")) | ||
|
||
# When | ||
actual_response = await Git(FakeContentManager("/bin")).tags("test_curr_path") | ||
|
||
# Then | ||
mock_execute.assert_called_once_with( | ||
["git", "tag", "--list"], | ||
cwd=os.path.join("/bin", "test_curr_path"), | ||
) | ||
|
||
assert {"code": 0, "tags": [tag]} == actual_response | ||
|
||
@pytest.mark.asyncio | ||
async def test_git_tag_checkout_success(): | ||
with patch("os.environ", {"TEST": "test"}): | ||
with patch("jupyterlab_git.git.execute") as mock_execute: | ||
tag = "mock_tag" | ||
# Given | ||
mock_execute.return_value = maybe_future((0, "", "")) | ||
|
||
# When | ||
actual_response = await Git(FakeContentManager("/bin")).tag_checkout("test_curr_path", "mock_tag") | ||
|
||
# Then | ||
mock_execute.assert_called_once_with( | ||
["git", "checkout", "tags/{}".format(tag)], | ||
cwd=os.path.join("/bin", "test_curr_path"), | ||
) | ||
|
||
assert {"code": 0, "message": "Tag {} checked out".format(tag)} == actual_response |
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
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
Oops, something went wrong.