Make sure all fields in paths are match those in routes
(routes, paths)
| 640 | |
| 641 | |
| 642 | def check_route_as_expected(routes, paths): |
| 643 | """Make sure all fields in paths are match those in routes""" |
| 644 | def dict_subset_eq(a, b): |
| 645 | """Is every key in B is the same in A?""" |
| 646 | return all(a.get(key) == b[key] for key in b) |
| 647 | |
| 648 | for path in paths: |
| 649 | found = False |
| 650 | for i in range(len(routes)): |
| 651 | route = routes[i] |
| 652 | if len(route['path']) != len(path): |
| 653 | continue |
| 654 | if all(dict_subset_eq(route['path'][i], path[i]) for i in range(len(path))): |
| 655 | del routes[i] |
| 656 | found = True |
| 657 | break |
| 658 | if not found: |
| 659 | raise ValueError("Could not find path {} in paths {}".format(path, routes)) |
| 660 | |
| 661 | if routes != []: |
| 662 | raise ValueError("Did not expect paths {}".format(routes)) |
| 663 | |
| 664 | |
| 665 | def check_getroute_paths(node, |
no test coverage detected