opensourcerouting / frr

Free Range Routing Protocol Suite
Other
37 stars 12 forks source link

Topotato: Regex Json Compare Directive #134

Open eznix86 opened 1 year ago

eznix86 commented 1 year ago

Usage:


compare = {
   "item": JsonCompareRegex(r"\s+"),
   "item1": JsonCompareRegex(r"\d+"),
   "item2": JsonCompareRegex("[A-Z]+"),
   "item3": JsonCompareRegex(r"^%?FRRouting/")
}

Example of errors:

E       topotato.exceptions.TopotatoCLICompareFail: json["item"] dict value is different (
E       1 vs regex '\\s+')
E       topotato.exceptions.TopotatoCLICompareFail: json["item1"] dict value is different (
E       abcd vs regex '\\d+')