def test_slave_passes_whitelist(): fake_slave = { 'attributes': { 'location_type': 'fake_location', 'fake_location_type': 'fake_location' } } fake_whitelist_allow = ['fake_location_type', ['fake_location']] fake_whitelist_deny = ['anoterfake_location_type', ['anotherfake_location']] slave_passes = mesos_tools.slave_passes_whitelist(fake_slave, fake_whitelist_deny) assert not slave_passes slave_passes = mesos_tools.slave_passes_whitelist(fake_slave, fake_whitelist_allow) assert slave_passes slave_passes = mesos_tools.slave_passes_whitelist(fake_slave, []) assert slave_passes