diff --git a/tests/__init__.py b/tests/__init__.py index f93407e..520e6d3 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -38,6 +38,7 @@ import mock import pygit2 import redis +from bs4 import BeautifulSoup from celery.app.task import EagerResult from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker @@ -102,24 +103,25 @@ def get_wait_target(html): return found[-1] -POST_REGEX = re.compile("""
') def get_post_args(html): - """ This parses from the wait page the hidden arguments for the form. """ - found = INPUT_REGEX.findall(html) - if len(found) == 0: - raise Exception("Not able to get the POST arguments in %s" % html) + """ This parses the wait page for the hidden arguments of the form. """ + soup = BeautifulSoup(html, 'html.parser') output = {} - for key, val in found: - output[key] = val + inputs = soup.find_all('input') + if not inputs: + raise Exception("Not able to get the POST arguments in %s" % html) + for inp in inputs: + if inp.get('type') == 'hidden': + output[inp.get('name')] = inp.get('value') return output