def test_isfile_when_exists(isfile_base): ("plant.isfile should return os.path.isfile when given path exists") isfile_base.return_value = "yeah!" isfile("/foo", True).should.equal("yeah!") isfile_base.assert_called_once_with("/foo")
def __init__(self, path): FakeNode.refcount += 1 self.path = "/{0}".format(path.strip('/')) self.path_regex = '^{0}'.format(self.path) self.is_file = isfile(path, False) self.is_dir = isdir(path, False) self.exists = False self.metadata = Mock() self.metadata.atime = FakeNode.refcount self.metadata.ctime = FakeNode.refcount self.metadata.mtime = FakeNode.refcount
def test_isfile_if_path_doesnt_exists_and_hasnt_a_dot(isfile_base): ('fs.isfile returns result from os.path.isfile if path doesnt ' 'exist and name doesnt have not a dot') isfile('foobar', False).should.equal(False)
def test_isfile_if_path_doesnt_exists_and_has_dot(isfile_base): ('fs.isfile returns result from os.path.isfile if path doesnt ' 'exist and name has a dot') isfile('foobar.py', False).should.equal(True)
def test_isfile_if_path_exists(isfile_base): ('fs.isfile returns result from os.path.isfile if path exists') isfile('foobar', True).should.equal(isfile_base.return_value) isfile_base.assert_once_called_with('foobar')
def test_isfile_if_path_exists(isfile_base): ('fs.isfile returns result from os.path.isfile if path exists') isfile('foobar', True).should.equal(isfile_base.return_value) isfile_base.assert_called_once_with('foobar')