def test_delete_twice(self, tmpdir): """Verify the second deletion is ignored.""" tmpdir.chdir() mapper = Helper("real/path/to/file") mapper.delete() assert not os.path.exists(mapper.path)
def test_create(self, tmpdir): """Verify files can be created.""" tmpdir.chdir() mapper = Helper("real/path/to/file") mapper.create(None) assert os.path.isfile(mapper.path)
def test_delete(self): """Verify fake files can be deleted.""" mapper = Helper("fake/path/to/file") mapper.create(None) mapper.delete() assert not os.path.exists(mapper.path)
def test_delete(self, tmpdir): """Verify files can be deleted.""" tmpdir.chdir() mapper = Helper("real/path/to/file") mapper.create(None) mapper.delete() assert not os.path.exists(mapper.path)
def test_create_twice(self, tmpdir): """Verify the second creation is ignored.""" tmpdir.chdir() mapper = Helper("real/path/to/file") mapper.create(None) mapper.create(None) assert os.path.isfile(mapper.path)
def test_modified(self): """Verify fake files can be modified.""" mapper = Helper("fake/path/to/file") assert mapper.modified mapper.create(None) assert mapper.modified mapper.modified = False assert not mapper.modified mapper.modified = True assert mapper.modified
def test_modified(self, tmpdir): """Verify files track modifications.""" tmpdir.chdir() mapper = Helper("real/path/to/file") assert mapper.modified mapper.create(None) assert mapper.modified mapper.modified = False assert not mapper.modified mapper.modified = True assert mapper.modified
def test_create(self): """Verify fake files can be created.""" mapper = Helper("fake/path/to/file") mapper.create(Mock()) assert not os.path.exists(mapper.path)
def test_modified_deleted(self): """Verify a deleted file is always modified.""" mapper = Helper("fake/path/to/file") assert mapper.modified