예제 #1
0
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")
예제 #2
0
파일: base.py 프로젝트: mochichitu/plant-1
 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
예제 #3
0
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)
예제 #4
0
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)
예제 #5
0
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')
예제 #6
0
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)
예제 #7
0
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)
예제 #8
0
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')