Repository: amwa-tv/nmos-testing
Issue: IS-08 Audio Channel Mapping - Index out of range

There are in total 4 occurrences where the outputs are retrieved and immediately accessed.
For example: 
```python
testRouteAction = outputList[0].findAcceptableTestRoute()
```
Line 75

This happens in `test_02`, `test_05`, `test_06` and in `    def check_delayed_activation(self, activationTime, activationType)`

Would it be sufficient to return a test.NA in these cases?

Changed files:
nmostesting/suites/IS0801Test.py

diff --git a/nmostesting/suites/IS0801Test.py b/nmostesting/suites/IS0801Test.py
index 8c087fb..e031bb5 100644
--- a/nmostesting/suites/IS0801Test.py
+++ b/nmostesting/suites/IS0801Test.py
@@ -72,6 +72,9 @@ class IS0801Test(GenericTest):
         globalConfig.test = test
 
         outputList = getOutputList()
+        if len(outputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
+
         testRouteAction = outputList[0].findAcceptableTestRoute()
         activation = Activation()
         activation.addAction(testRouteAction)
@@ -105,6 +108,9 @@ class IS0801Test(GenericTest):
 
         Active().unrouteAll()
         outputList = getOutputList()
+        if len(outputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
+
         testRouteAction = outputList[0].findAcceptableTestRoute()
         activation = Activation()
         activation.addAction(testRouteAction)
@@ -127,6 +133,9 @@ class IS0801Test(GenericTest):
         globalConfig.test = test
 
         outputList = getOutputList()
+        if len(outputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
+
         testRouteAction = outputList[0].findAcceptableTestRoute()
         activation = Activation()
         activation.addAction(testRouteAction)
@@ -145,6 +154,9 @@ class IS0801Test(GenericTest):
         activeInstance = Active()
 
         outputList = getOutputList()
+        if len(outputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
+
         for outputInstance in outputList:
             channelList = outputInstance.getChannelList()
             for channelID in range(0, len(channelList)):
@@ -172,6 +184,9 @@ class IS0801Test(GenericTest):
         forbiddenRoutes = []
         outputList = getOutputList()
         inputList = getInputList()
+        if len(inputList) == 0 or len(outputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
+
         for outputInstance in outputList:
             sourceID = outputInstance.getSourceID()
             for inputInstance in inputList:
@@ -207,6 +222,8 @@ class IS0801Test(GenericTest):
         """Inputs have at least one channel represented in their channels resource"""
         globalConfig.test = test
         inputList = getInputList()
+        if len(inputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
         for inputInstance in inputList:
             channels = inputInstance.getChannelList()
             if len(channels) == 0:
@@ -216,8 +233,9 @@ class IS0801Test(GenericTest):
     def test_12(self, test):
         """Outputs have at least one channel represented in their channels resource"""
         globalConfig.test = test
-
         outputList = getOutputList()
+        if len(outputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
         for outputInstance in outputList:
             channels = outputInstance.getChannelList()
             if len(channels) == 0:
@@ -229,6 +247,11 @@ class IS0801Test(GenericTest):
         globalConfig.test = test
 
         outputList = getOutputList()
+        inputList = getInputList()
+
+        if len(inputList) == 0 and len(outputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
+
         constrainedOutputList = []
         for outputInstance in outputList:
             constraints = outputInstance.getCaps()
@@ -247,7 +270,6 @@ class IS0801Test(GenericTest):
         if len(constrainedOutputList) == 0:
             return test.NA("Could not test - no outputs have routing constraints set.")
 
-        inputList = getInputList()
         inputIDList = []
         for inputInstance in inputList:
             inputIDList.append(inputInstance.id)
@@ -280,6 +302,8 @@ class IS0801Test(GenericTest):
         globalConfig.test = test
 
         inputList = getInputList()
+        if len(inputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
 
         constrainedInputs = []
         constraintSet = False
@@ -353,6 +377,9 @@ class IS0801Test(GenericTest):
         globalConfig.test = test
 
         inputList = getInputList()
+        if len(inputList) == 0:
+            return test.UNCLEAR("Not tested. No resources found.")
+
         constraintSet = False
         constrainedInputs = []
         for inputInstance in inputList:
@@ -384,6 +411,10 @@ class IS0801Test(GenericTest):
         preActivationState = active.buildJSONObject()
 
         outputList = getOutputList()
+        if len(outputList) == 0:
+            msg = globalConfig.test.UNCLEAR("Not tested. No resources found.")
+            raise NMOSTestException(msg)
+
         testRouteAction = outputList[0].findAcceptableTestRoute()
         activation = Activation()
         activation.addAction(testRouteAction)