From 40ece7cc4f5931ad1869fb6beab9d296b2b70551 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Sun, 20 Oct 2019 21:22:09 +0200 Subject: [PATCH] add test helpers to check for text in the HTML output --- sensors/collector/tests/helper.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sensors/collector/tests/helper.py diff --git a/sensors/collector/tests/helper.py b/sensors/collector/tests/helper.py new file mode 100644 index 0000000..9cad187 --- /dev/null +++ b/sensors/collector/tests/helper.py @@ -0,0 +1,12 @@ +def in_content(response, string): + decoded_content = response.content.decode('utf8') + if string not in decoded_content: + return False + return True + + +def not_in_content(response, string): + decoded_content = response.content.decode('utf8') + if string in decoded_content: + return False + return True