Created
February 18, 2015 13:50
-
-
Save Ram-Z/65195c92bbdce36320c1 to your computer and use it in GitHub Desktop.
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
def test_validate_expanduser(self, os_path): | |
"""Test if validate expands the user correctly.""" | |
# os_path.expandvars.side_effect = lambda x: x.replace('$BAR', | |
# '/home/foo/bar') | |
os_path.expandvars = os.path.expandvars | |
os_path.expanduser.side_effect = lambda x: x.replace('~', '/home/foo') | |
os_path.isdir.side_effect = lambda path: path == '/home/foo/foobar' | |
os_path.isabs.return_value = True | |
with helpers.environ_set_temp('FOO', 'foo'): | |
self.t.validate('~/foobar') | |
os_path.expanduser.assert_called_once_with('~/foobar') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment