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