File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- import mock
16
15
import pytest
17
16
18
17
@@ -28,19 +27,19 @@ def test_index(app):
28
27
assert r .status_code == 200
29
28
30
29
31
- @mock .patch ('logging.warn' )
32
- def test_log_payload (logging_mock , app ):
33
- payload = 'hello'
30
+ def test_log_payload (capsys , app ):
31
+ payload = 'test_payload'
34
32
35
33
r = app .post ('/log_payload' , data = payload )
36
34
assert r .status_code == 200
37
35
38
- assert logging_mock .called
36
+ out , _ = capsys .readouterr ()
37
+ assert payload in out
39
38
40
39
41
- @mock .patch ('logging.warn' )
42
- def test_empty_payload (logging_mock , app ):
40
+ def test_empty_payload (capsys , app ):
43
41
r = app .post ('/log_payload' )
44
42
assert r .status_code == 200
45
43
46
- assert logging_mock .called
44
+ out , _ = capsys .readouterr ()
45
+ assert 'empty payload' in out
You can’t perform that action at this time.
0 commit comments