summaryrefslogtreecommitdiff
blob: a03aa445137b2b395caadb8af2528d9df90cc016 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
commit c367a86cc5be70da4928b276d0218f98df6e854d
Author: Fernanda Guimarães <fernandaguimaraes28@gmail.com>
Date:   Mon Oct 28 21:37:25 2019 -0300

    Test test_send_from_directory_bad_request no longer fails in Python 3.8.

diff --git a/tests/test_helpers.py b/tests/test_helpers.py
index 78a56221..21735af1 100644
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -11,6 +11,7 @@
 import datetime
 import io
 import os
+import sys
 import uuid
 
 import pytest
@@ -780,12 +781,17 @@ class TestSendfile(object):
         assert rv.data.strip() == b"Hello Subdomain"
         rv.close()
 
-    def test_send_from_directory_bad_request(self, app, req_ctx):
+    def test_send_from_directory_null_character(self, app, req_ctx):
         app.root_path = os.path.join(
             os.path.dirname(__file__), "test_apps", "subdomaintestmodule"
         )
 
-        with pytest.raises(BadRequest):
+        if sys.version_info >= (3, 8):
+            exception = NotFound
+        else:
+            exception = BadRequest
+
+        with pytest.raises(exception):
             flask.send_from_directory("static", "bad\x00")