Merge pull request #207 from cdent/fix-150

Allow substitutions in count and delay
This commit is contained in:
Chris Dent 2017-03-14 13:41:41 +00:00 committed by GitHub
commit bb7867aed3
2 changed files with 8 additions and 6 deletions

View File

@ -442,8 +442,9 @@ class HTTPTestCase(testtools.TestCase):
body = body.encode('UTF-8')
if test['poll']:
count = test['poll'].get('count', 1)
delay = test['poll'].get('delay', 1)
count = int(float(self.replace_template(
test['poll'].get('count', 1))))
delay = float(self.replace_template(test['poll'].get('delay', 1)))
failure = None
while count:
try:

View File

@ -26,7 +26,7 @@ tests:
# Confirm that $LOCATION and $RESPONSE behave in poll.
- name: create a thing
url: /poller?count=2&x=1&y=2
url: /poller?count=2&x=1&y=2&z=3.4
method: POST
request_headers:
content-type: application/json
@ -34,15 +34,16 @@ tests:
count: 3
delay: .01
response_json_paths:
$.x[0]: '1'
$.y[0]: '2'
$.x[0]: "1"
$.y[0]: "2"
$.z[0]: "3.4"
- name: loop location
url: $LOCATION
verbose: True
poll:
count: 3
count: $RESPONSE['$.z[0]']
delay: .01
response_json_paths:
$.x[0]: $RESPONSE['$.x[0]']