def test_isdir_when_exists(isdir_base): ("plant.isdir should return os.path.isdir when given path exists") isdir_base.return_value = "yeah!" isdir("/foo", True).should.equal("yeah!") isdir_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_isdir_if_path_doesnt_exists_and_hasnt_a_dot(isdir_base): ('fs.isdir returns result from os.path.isdir if path doesnt ' 'exist and name doesnt have a dot') isdir('foobar', False).should.equal(True)
def test_isdir_if_path_doesnt_exists_and_has_dot(isdir_base): ('fs.isdir returns result from os.path.isdir if path doesnt ' 'exist and have not a dot') isdir('foobar.py', False).should.equal(False)
def test_isdir_if_path_exists(isdir_base): ('fs.isdir returns result from os.path.isdir if path exists') isdir('foobar', True).should.equal(isdir_base.return_value) isdir_base.assert_once_called_with('foobar')
def test_isdir_if_path_exists(isdir_base): ('fs.isdir returns result from os.path.isdir if path exists') isdir('foobar', True).should.equal(isdir_base.return_value) isdir_base.assert_called_once_with('foobar')