owncloud / data_exporter

Export/Import for ownCloud user data
GNU General Public License v2.0
7 stars 5 forks source link

[Tests-Only] Revert "Disabled trashbin-test" #145

Closed phil-davis closed 4 years ago

phil-davis commented 4 years ago

Fixes issue #138

1) adjustments to acceptance tests: trashbinExport/userbar data for import was missing a files folder, so actually the import attempt failed because the the import data really was invalid.

The test had too many levels of nested folders. Unfortunately a core step like:

    And user "usertrash" restores the file with original path "AFolder/L1/L2/DeletedFolder" using the trashbin API

does not correctly find files or folders to restore from that deep down. That needs to be enhanced/fixed in the core test infrastructure. I will made a separate issue for that - https://github.com/owncloud/core/issues/37127

I made the test scenario not be so many levels down. I created the export that is used as the import for this scenario by running:

    Given user "usertrash" has been created with default attributes and without skeleton files
    And user "usertrash" has created folder "AFolder"
    And user "usertrash" has created folder "AFolder/DeletedFolder"
    And user "usertrash" has uploaded file with content "text in file in deleted folder" to "AFolder/DeletedFolder/fileinfolder.txt"
    And user "usertrash" has uploaded file with content "text in deleted file" to "AFolder/DeletedFile.txt"
    And user "usertrash" has uploaded file with content "text in ordinary file" to "AFolder/fileInFolder.txt"
    And user "usertrash" has deleted folder "AFolder/DeletedFolder"
    And user "usertrash" has deleted file "AFolder/DeletedFile.txt"
    When user "usertrash" is exported to path "/fooSomething" using the occ command

We can also (later) make scenarios like this that create "complicated" exports, and have steps that check the content of the export.

2) The files to be imported were being opened read-write. In drone those files (from the tests/acceptance/data folder) are read-only. That made the import fail. Actually it should be possible (and good) to import from an export that is read-only. I fixed the code so it opens the files read-only.

After getting this PR merged, then we can move forward to make variations of interesting test scenarios...

codecov[bot] commented 4 years ago

Codecov Report

Merging #145 into master will not change coverage by %. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #145   +/-   ##
=========================================
  Coverage     86.18%   86.18%           
  Complexity      235      235           
=========================================
  Files            35       35           
  Lines          1115     1115           
=========================================
  Hits            961      961           
  Misses          154      154           
Impacted Files Coverage Δ Complexity Δ
lib/Importer/FilesImporter.php 94.11% <100.00%> (ø) 10.00 <0.00> (ø)
lib/Importer/TrashBinImporter.php 72.30% <100.00%> (ø) 12.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d2c383f...1749330. Read the comment docs.