Exemplo n.º 1
0
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")
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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')
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
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')