Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add tests for symlink creation #761

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

the-eversio
Copy link
Contributor

Pull Request Check List

  • Added tests for changed code.

Description:

I found it a bit hard to change the code here without tests, so I added some. This also found a couple of bugs:

  • update_item_folder was causing some weird behaviours with files in the rclone root, and also when alternative_folder was used. I can't see anywhere that's required, so I removed it.
  • There were two different, conflicting ways of finding the media in the rclone path. I removed the more simplistic one.

I also added some type checks / empty value checks and marked private methods as such.

This should merge cleanly with #758, which removes a bunch of duplicate code also related to symlinks.

I found it a bit hard to change the code here without tests, so I added some.
This also found a couple of bugs:

- `update_item_folder` was causing some weird behaviours with files in the
  rclone root, and also when `alternative_folder` was used. I can't see anywhere
  that's required, so I removed it.
- There were two different, conflicting ways of finding the media in the
  rclone path. I removed the more simplistic one.

I also added some type checks / empty value checks and marked private methods as
such.
@@ -217,7 +208,6 @@ def _symlink(self, item: Union[Movie, Episode]) -> bool:
extension = os.path.splitext(item.file)[1][1:]
symlink_filename = f"{filename}.{extension}"
destination = self._create_item_folders(item, symlink_filename)
source = os.path.join(self.rclone_path, item.folder, item.file)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed because the logic is different to _get_item_path, which I use instead now.

@Gaisberg Gaisberg merged commit 667e884 into rivenmedia:main Oct 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants