-
Notifications
You must be signed in to change notification settings - Fork 849
Only set default filename in files_upload if file is an instance of str #810
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
Conversation
3ef65f3 changed files_upload behavior to always set default filename regardless of instace type of file input parameter. If file is of type IOBase, line 1496 would raise an exception. Since the Slack API files_upload does not require a filename to upload, I do not believe this method should either
e149f46 to
7721499
Compare
|
None of the integrations tests appear to be run by |
Codecov Report
@@ Coverage Diff @@
## main #810 +/- ##
=======================================
Coverage 87.29% 87.29%
=======================================
Files 30 30
Lines 3722 3722
Branches 328 328
=======================================
Hits 3249 3249
Misses 330 330
Partials 143 143
Continue to review full report at Codecov.
|
|
@csaska Thanks for making this PR!
You can use Running all the integration tests requires preps. You can run a single test case by We would like to have both a unit test and an integration test for this case but I can take the task. Your change looks good to me already and you don't need to use more of your time for this. Thanks a lot! I will work on tests and will be releasing a new patch version soon. |
|
@seratch thanks for the follow up about the unit tests and quick turnaround! |
Summary
Fixes #809
3ef65f3 changed files_upload behavior to always set default filename regardless of instace type of file input parameter. If file is of type IOBase, which the type hinting indicates is supported, #L1496 would raise an exception when trying to call
spliton a non-string type. Since the Slack API files_upload does not require a filename to upload, I do not believe this method should either.No unit tests added as this code change should still be coverd by https://github.com/slackapi/python-slackclient/blob/033fb44f64d5c5f5664a8b6752adf3e4beba7854/integration_tests/web/test_issue_672.py#L65
I can add a test for
filebeing anIOBaseinstance.Category (place an
xin each of the[ ])Requirements (place an
xin each[ ])python setup.py validateafter making the changes.