Repository: amwa-tv/nmos-testing
Issue: IndexError list index out of range in IS0501Test

When running test_15, a failure was recorded on line 907 of IS0501Test.py in check_staged_complies_with_constraints

```
 * Running test_15
 * ERROR: list index out of range
192.168.201.184 - - [15/Jan/2019 15:01:55] "POST / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/ipstudio-admin/nmos-testing/nmos-test.py", line 218, in index_page
    raise ex
  File "/home/ipstudio-admin/nmos-testing/nmos-test.py", line 215, in index_page
    result = test_obj.run_tests(test_selection)
  File "/home/ipstudio-admin/nmos-testing/GenericTest.py", line 133, in run_tests
    self.execute_tests(test_name)
  File "/home/ipstudio-admin/nmos-testing/GenericTest.py", line 101, in execute_tests
    self.result.append(method())
  File "/home/ipstudio-admin/nmos-testing/IS0501Test.py", line 383, in test_15
    valid, response = self.check_staged_complies_with_constraints("sender", self.senders)
  File "/home/ipstudio-admin/nmos-testing/IS0501Test.py", line 907, in check_staged_complies_with_constraints
    schema.update(constraints_response[count])
IndexError: list index out of range

```

Changed files:
IS0501Test.py

diff --git a/IS0501Test.py b/IS0501Test.py
index 2c41778..b0f9995 100644
--- a/IS0501Test.py
+++ b/IS0501Test.py
@@ -904,7 +904,11 @@ class IS0501Test(GenericTest):
                     count = 0
                     try:
                         for params in response['transport_params']:
-                            schema.update(constraints_response[count])
+                            try:
+                                schema.update(constraints_response[count])
+                            except IndexError:
+                                return False, "Number of 'legs' in constraints does not match the number in " \\
+                                              "transport_params"
                             try:
                                 Draft4Validator(schema['items'], resolver=resolver).validate(params)
                             except ValidationError as e: