Skip to content

Commit

Permalink
add test to make sure a destination is set
Browse files Browse the repository at this point in the history
... for an UploadSet

modified:   CHANGES.rst
modified:   tests/test_flask_reuploaded.py
modified:   tox.ini
  • Loading branch information
jugmac00 committed Jan 18, 2021
1 parent 7977638 commit 31732e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Changelog

unreleased
----------
- nothing yet
- improve coverage


0.5.0
Expand Down
9 changes: 9 additions & 0 deletions tests/test_flask_reuploaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from flask_uploads import UploadNotAllowed
from flask_uploads import UploadSet
from flask_uploads import addslash
from flask_uploads import config_for_set
from flask_uploads import configure_uploads
from flask_uploads import extension
from flask_uploads import lowercase_ext
Expand Down Expand Up @@ -355,3 +356,11 @@ def test_url_based(self):
url = uset.url('foo.txt')
assert url == 'http://localhost:5001/foo.txt'
assert '_uploads' not in app.blueprints


def test_configure_for_set_throws_runtimeerror():
"""when there is no destination for an UploadSet"""
upload_set = UploadSet("files")
app = Flask(__name__)
with pytest.raises(RuntimeError):
config_for_set(upload_set, app)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ envlist =

[testenv]
extras = test
deps = pdbpp
commands = pytest {posargs}

[testenv:coverage]
Expand Down

0 comments on commit 31732e2

Please sign in to comment.