Make sure all fields in paths are match those in routes
(routes, paths)
| 687 | |
| 688 | |
| 689 | def check_route_as_expected(routes, paths): |
| 690 | """Make sure all fields in paths are match those in routes""" |
| 691 | def dict_subset_eq(a, b): |
| 692 | """Is every key in B is the same in A?""" |
| 693 | return all(a.get(key) == b[key] for key in b) |
| 694 | |
| 695 | for path in paths: |
| 696 | found = False |
| 697 | for i in range(len(routes)): |
| 698 | route = routes[i] |
| 699 | if len(route['path']) != len(path): |
| 700 | continue |
| 701 | if all(dict_subset_eq(route['path'][i], path[i]) for i in range(len(path))): |
| 702 | del routes[i] |
| 703 | found = True |
| 704 | break |
| 705 | if not found: |
| 706 | raise ValueError("Could not find path {} in paths {}".format(path, routes)) |
| 707 | |
| 708 | if routes != []: |
| 709 | raise ValueError("Did not expect paths {}".format(routes)) |
| 710 | |
| 711 | |
| 712 | def check_getroute_paths(node, |
no test coverage detected