Пример #1
0
def init_fs_with_entity(entity_type, drive_name="home", entity_name="test1"):
    fs = FileSystem()

    fs.create_drive(drive_name)
    new_entity = fs.create(entity_type, entity_name, drive_name)

    return fs, new_entity
Пример #2
0
    def test_cannot_create_entity_if_no_drives_exist(self):
        fs = FileSystem()

        with self.assertRaises(PathNotFoundException):
            fs.create(EntityType.ZIP_FILE, "file.zip", "")
Пример #3
0
    def test_cannot_create_file_if_parent_does_not_exist(self):
        fs = FileSystem()
        fs.create_drive("home")

        with self.assertRaises(PathNotFoundException):
            fs.create(EntityType.FILE, "file1.txt", "home\\does_not_exist")
Пример #4
0
    def test_cannot_create_drive_with_create(self):
        fs = FileSystem()

        with self.assertRaises(ValueError):
            fs.create(EntityType.DRIVE, "home", "")