Make the test.errors.count value explicit, update tests which had an implicit count
This commit is contained in:
7
tests.py
7
tests.py
@ -58,12 +58,9 @@ class YAMLTest(unittest.TestCase):
|
||||
|
||||
v = Validator(schema=self.yaml_schema)
|
||||
rv, msgs = v.validate(cfg)
|
||||
count = None
|
||||
try:
|
||||
count = 0
|
||||
if 'test' in unittest and 'errors' in unittest['test'] and 'count' in unittest['test']['errors']:
|
||||
count = unittest['test']['errors']['count']
|
||||
except:
|
||||
pass
|
||||
if isinstance(count, int):
|
||||
assert len(msgs) == count, "%s: Expected %d error messages, got %d" % (self.yaml_filename, count, len(msgs))
|
||||
|
||||
msgs_unexpected = 0
|
||||
|
@ -4,6 +4,7 @@ test:
|
||||
expected:
|
||||
- "mtu.*less than 128"
|
||||
- "mtu.*greater than 9216"
|
||||
count: 2
|
||||
---
|
||||
interfaces:
|
||||
GigabitEthernet1/0/0:
|
||||
|
@ -3,6 +3,7 @@ test:
|
||||
errors:
|
||||
expected:
|
||||
- "sub-interface .* has MTU 9001 higher than parent MTU 9000"
|
||||
count: 1
|
||||
---
|
||||
interfaces:
|
||||
GigabitEthernet1/0/0:
|
||||
|
@ -4,6 +4,7 @@ test:
|
||||
expected:
|
||||
- "100 .* unique encapsulation"
|
||||
- "101 .* unique encapsulation"
|
||||
count: 2
|
||||
---
|
||||
interfaces:
|
||||
GigabitEthernet1/0/0:
|
||||
|
@ -3,6 +3,7 @@ test:
|
||||
errors:
|
||||
expected:
|
||||
- "sub-interface .* has LCP but .* does not have LCP"
|
||||
count: 1
|
||||
---
|
||||
interfaces:
|
||||
GigabitEthernet1/0/0:
|
||||
|
@ -3,6 +3,7 @@ test:
|
||||
errors:
|
||||
expected:
|
||||
- "sub-interface .* has LCP with too long name"
|
||||
count: 1
|
||||
---
|
||||
interfaces:
|
||||
GigabitEthernet1/0/0:
|
||||
|
@ -3,6 +3,7 @@ test:
|
||||
errors:
|
||||
expected:
|
||||
- "sub-interface .* has an address but .* does not have LCP"
|
||||
count: 1
|
||||
---
|
||||
interfaces:
|
||||
GigabitEthernet1/0/0:
|
||||
|
@ -3,6 +3,7 @@ test:
|
||||
errors:
|
||||
expected:
|
||||
- "sub-interface .* has no config"
|
||||
count: 1
|
||||
---
|
||||
interfaces:
|
||||
GigabitEthernet1/0/0:
|
||||
|
Reference in New Issue
Block a user