Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This test is pretty exhaustive, and probably overkill for the needs, but it's got 90% code coverage so that's pretty good.
There's some odd things that weren't able to provide coverage for though:
Message.dumps()
:try
on line 451Message.fromFileInfo()
:msg
at every run, so couldn't get it to do the rename bits on lines 532-536. How sure how those are supposed to worknew_retrievePath
key, so theif o.rename
block on lines 543-547 throws a key error if it runs (there's a test case for that though)try
on line 555 to fail no matter how many directories were striped, so theexcept
never runsMessage.updatePaths()
:new_dir
andnew_file
parameters are optional, but their concatenation on line 686 throws an error if they're not set (there's a test case for this too)new_dir
effectively being mandatory, theif
s on lines 719 and 735 don't really work properly because they can never evaluate toTrue
Interesting bits/lessons learned when writing these tests:
random.choice
's return withNone
urllib.request.urlopen
's return as a static string, bypassing the need to actually do an HTTP request