-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#328] Menu commands to show cookie cutter and metadata template files
- Loading branch information
1 parent
48f2a5c
commit 15fd011
Showing
8 changed files
with
106 additions
and
28 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
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
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,44 @@ | ||
import platform | ||
import unittest | ||
import subprocess | ||
import sys | ||
|
||
from mock import patch | ||
|
||
from inselect.gui.utils import reveal_path | ||
from inselect.tests.utils import temp_directory_with_files | ||
|
||
|
||
class TestUtils(unittest.TestCase): | ||
"""Test GUI utils | ||
""" | ||
@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") | ||
@patch.object(subprocess, 'call', return_value=1) | ||
def test_reveal_path_windows(self, mock_subprocess): | ||
with temp_directory_with_files() as tempdir: | ||
path = tempdir / 'xyz' | ||
path.open('w') | ||
reveal_path(path) | ||
expected = [ | ||
"explorer.exe", | ||
u"/select,{0}".format(str(path.resolve())) | ||
] | ||
mock_subprocess.assert_called_once_with(expected) | ||
|
||
@unittest.skipUnless('Darwin' == platform.system(), "requires OS X") | ||
@patch.object(subprocess, 'check_call') | ||
def test_reveal_path_os_x(self, mock_subprocess): | ||
with temp_directory_with_files() as tempdir: | ||
path = tempdir / 'xyz' | ||
path.open('w') | ||
reveal_path(path) | ||
expected = [ | ||
'/usr/bin/osascript', | ||
'-e', | ||
u'tell application "Finder" to reveal POSIX file "{0}"'.format(str(path.resolve())) | ||
] | ||
mock_subprocess.assert_any_call(expected) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |