def test_resolve_devices_stable_names(fake_device): original = [ lvmfilter.FilterItem("a", "^{}$".format(fake_device.stable_link)), lvmfilter.FilterItem("r", ".*"), ] resolved = [ lvmfilter.FilterItem("a", "^{}$".format(fake_device.device)), lvmfilter.FilterItem("r", ".*"), ] assert lvmfilter.resolve_devices(original) == resolved
def test_resolve_devices_no_anchors(): original = [ lvmfilter.FilterItem("a", "/dev/sda1"), lvmfilter.FilterItem("a", "^/dev/sdb"), lvmfilter.FilterItem("r", ".*"), ] resolved = [ lvmfilter.FilterItem("a", "/dev/sda1"), lvmfilter.FilterItem("a", "^/dev/sdb"), lvmfilter.FilterItem("r", ".*"), ] assert lvmfilter.resolve_devices(original) == resolved
def test_resolve_devices_wild_cards(): original = [ lvmfilter.FilterItem("a", "^/dev/sda1$"), lvmfilter.FilterItem("a", "^/dev/sdb.*"), lvmfilter.FilterItem("r", ".*"), ] resolved = [ lvmfilter.FilterItem("a", "^/dev/sda1$"), lvmfilter.FilterItem("a", "^/dev/sdb.*"), lvmfilter.FilterItem("r", ".*"), ] assert lvmfilter.resolve_devices(original) == resolved