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 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- import mock
1615import pytest
1716
1817
@@ -28,19 +27,19 @@ def test_index(app):
2827 assert r .status_code == 200
2928
3029
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'
3432
3533 r = app .post ('/log_payload' , data = payload )
3634 assert r .status_code == 200
3735
38- assert logging_mock .called
36+ out , _ = capsys .readouterr ()
37+ assert payload in out
3938
4039
41- @mock .patch ('logging.warn' )
42- def test_empty_payload (logging_mock , app ):
40+ def test_empty_payload (capsys , app ):
4341 r = app .post ('/log_payload' )
4442 assert r .status_code == 200
4543
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