Testing #5

Open
opened 2022-03-07 07:44:02 +00:00 by adam · 1 comment
adam commented 2022-03-07 07:44:02 +00:00 (Migrated from git.theadamcooper.com)

Integration test:

N.B. This is probably not necessary.
  1. Create a testing file tree in Nextcloud with maybe five items in three levels. File content can be kept in a tests folder here.
  2. Publicise them.
  3. Tear this file tree down.

Unit tests:

  1. Adjust traverse function to take a parameter that skips the publicise_it call.
  2. Once that's done we should be able to test each function on its own.
  3. Functions
    • traverse
      • Adjust it to return the hashmap of visited items.
    • publicise_it
      • Create a test_user on our Nextcloud installation.
      • Create a file there.
      • Publicise it.
      • Delete it.
      • Alternatively can we do this with a mock/stub/whatever?
### Integration test: ###### N.B. This is probably not necessary. 1. Create a testing file tree in Nextcloud with maybe five items in three levels. File content can be kept in a tests folder here. 1. Publicise them. 1. Tear this file tree down. ### Unit tests: 1. Adjust `traverse` function to take a parameter that skips the `publicise_it` call. 1. Once that's done we should be able to test each function on its own. 1. Functions - `traverse` - Adjust it to return the hashmap of visited items. - `publicise_it` - Create a test_user on our Nextcloud installation. - Create a file there. - Publicise it. - Delete it. - Alternatively can we do this with a mock/stub/whatever?
adam commented 2022-03-21 06:35:03 +00:00 (Migrated from git.theadamcooper.com)

Some decoupling needs to happen—between get_folder_contents and traverse—before unit testing would work well.

  • traverse would return a tuple.
  • We'd wrap the call to traverse in a while loop, running until the vector is empty.
  • In traverse, we run a while loop, running until we encounter a collection. We return the collection href as well as the visited items hashmap (and the Multistatus struct?).
  • Back in main, we take the collection href and call get_folder_contents, and tack the results on the end of the queue as now.
  • We can test get_folder_contents with some kind of mock/stub/whatever.
    This application is too vapid to shoulder this burden, so we'll probably never do this. If we do, we should create a new issue for the refactor described herein.
Some decoupling needs to happen—between `get_folder_contents` and `traverse`—before unit testing would work well. - `traverse` would return a tuple. - We'd wrap the call to `traverse` in a while loop, running until the vector is empty. - In `traverse`, we run a while loop, running until we encounter a collection. We return the collection href as well as the visited items hashmap (and the Multistatus struct?). - Back in `main`, we take the collection href and call `get_folder_contents`, and tack the results on the end of the queue as now. - We can test `get_folder_contents` with some kind of mock/stub/whatever. This application is too vapid to shoulder this burden, so we'll probably never do this. If we do, we should create a new issue for the refactor described herein.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: adam/publicise-rs#5
No description provided.