       storage_id = params1.storage_id
 
       {:ok, _} = FileController.create(params1)
-      {:ok, file} = FileController.create(params2)
-
-      assert {:error, :file_exists} =
-        FileController.move(file, file_path, storage_id)
+      {:ok, file1} = FileController.create(params2)
+
+      # move yields expected error
+      assert {:error, :file_exists} ==
+        FileController.move(file1, file_path, storage_id)
+
+      {:ok, file2} = FileController.find(file1.file_id)
+
+      # file remains unchanged
+      assert file1 == file2
     end
   end
 

      params = generate_payload(context.file_type, context.storage)
      file_path = generate_path()
      storage_id = context.storage.storage_id
      {:ok, file} = FileController.create(params)
      {:ok, file} = FileController.copy(file, file_path, storage_id)

      assert {:ok, ^file} = FileController.find(file.file_id)
      assert file_path == file.file_path
    end

    test "copies to another storage", context do
      params = generate_payload(context.file_type, context.storage)
      {:ok, s} = StorageController.create()
      {:ok, file} = FileController.create(params)
      {:ok, file} = FileController.copy(file, file.file_path, s.storage_id)

      assert {:ok, ^file} = FileController.find(file.file_id)
      assert s.storage_id == file.storage_id
    end

    test "fails when file exists", context do
      params1 = generate_payload(context.file_type, context.storage)
      params2 =
        context.file_type

  describe "file fetching" do
    test "fetches an existent file", context do
      params = generate_payload(context.file_type, context.storage)
      {:ok, file1} = FileController.create(params)
      {:ok, file2} = FileController.find(file1.file_id)

      # found the same previously created file
      assert file1 == file2
    end

    test "find fails when files is not found" do
      # got expected error
      assert {:error, :notfound} == FileController.find(PK.generate([]))
    end
  end
