1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
from cola import resources
from . import helper
from .helper import patch
@patch('cola.resources.compat')
@patch('cola.resources.get_prefix')
def test_command_unix(mock_prefix, mock_compat):
"""Test the behavior of resources.command() on unix platforms"""
mock_compat.WIN32 = False
mock_prefix.return_value = helper.fixture()
expect = helper.fixture('bin', 'bare-cmd')
actual = resources.command('bare-cmd')
assert expect == actual
expect = helper.fixture('bin', 'exe-cmd')
actual = resources.command('exe-cmd')
assert expect == actual
@patch('cola.resources.compat')
@patch('cola.resources.get_prefix')
def test_command_win32(mock_prefix, mock_compat):
"""Test the behavior of resources.command() on unix platforms"""
mock_compat.WIN32 = True
mock_prefix.return_value = helper.fixture()
expect = helper.fixture('bin', 'bare-cmd')
actual = resources.command('bare-cmd')
assert expect == actual
# Windows will return exe-cmd.exe because the path exists.
expect = helper.fixture('bin', 'exe-cmd.exe')
actual = resources.command('exe-cmd')
assert expect == actual
|