Assert that html_tools.JSONNotFound is correctly raised

pull/159/head
Leigh 3 years ago
parent e2304b2ce0
commit 5a2c534fde

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 31 KiB

@ -3,6 +3,7 @@
import time import time
from flask import url_for from flask import url_for
from . util import live_server_setup from . util import live_server_setup
import pytest
def test_unittest_inline_html_extract(): def test_unittest_inline_html_extract():
# So lets pretend that the JSON we want is inside some HTML # So lets pretend that the JSON we want is inside some HTML
@ -36,8 +37,10 @@ and it can also be repeated
text = html_tools.extract_json_as_string('{"id":5}', "$.id") text = html_tools.extract_json_as_string('{"id":5}', "$.id")
assert text == "5" assert text == "5"
# @todo how to test for exception raised # When nothing at all is found, it should throw JSONNOTFound
# text = html_tools.extract_json_as_string('COMPLETE GIBBERISH, NO JSON!', "$.id") # Which is caught and shown to the user in the watch-overview table
with pytest.raises(html_tools.JSONNotFound) as e_info:
html_tools.extract_json_as_string('COMPLETE GIBBERISH, NO JSON!', "$.id")
def test_setup(live_server): def test_setup(live_server):

Loading…
Cancel
Save