summaryrefslogtreecommitdiff
path: root/tests/integration_tests/log_utils.py
diff options
context:
space:
mode:
authorJames Falcon <TheRealFalcon@users.noreply.github.com>2020-12-10 10:58:12 -0600
committerGitHub <noreply@github.com>2020-12-10 11:58:12 -0500
commit97bfd21d2dca978a662c87f0255a2a2bb97fc5d6 (patch)
tree646a8d58333171a974ae29bfef0bc2684ff750bb /tests/integration_tests/log_utils.py
parent1d1649e56e553576240cf4b1fafc098997b9ba6d (diff)
downloadvyos-cloud-init-97bfd21d2dca978a662c87f0255a2a2bb97fc5d6.tar.gz
vyos-cloud-init-97bfd21d2dca978a662c87f0255a2a2bb97fc5d6.zip
Integration test for LP: #1813396 and #669 (#719)
Ensure gpg is called with --no-tty flag. Also, refactored the "ordered_items_in_text" to assert if the line is missing and provide a more useful error message.
Diffstat (limited to 'tests/integration_tests/log_utils.py')
-rw-r--r--tests/integration_tests/log_utils.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/integration_tests/log_utils.py b/tests/integration_tests/log_utils.py
index fa807389..40baae7b 100644
--- a/tests/integration_tests/log_utils.py
+++ b/tests/integration_tests/log_utils.py
@@ -1,13 +1,11 @@
-def ordered_items_in_text(to_verify: list, text: str) -> bool:
- """Return if all items in list appear in order in text.
+def verify_ordered_items_in_text(to_verify: list, text: str):
+ """Assert all items in list appear in order in text.
Examples:
- ordered_items_in_text(['a', '1'], 'ab1') # Returns True
- ordered_items_in_text(['1', 'a'], 'ab1') # Returns False
+ verify_ordered_items_in_text(['a', '1'], 'ab1') # passes
+ verify_ordered_items_in_text(['1', 'a'], 'ab1') # raises AssertionError
"""
index = 0
for item in to_verify:
index = text[index:].find(item)
- if index < 0:
- return False
- return True
+ assert index > -1, "Expected item not found: '{}'".format(item)