def test_exclude_servers_success(self): """ :class:`ExcludesServers` succeeds when the active list does not contain any servers with the given server IDS """ matcher = ExcludesServers(['id1', 'id2']) mismatch = matcher.match( {'active': [{'id': "id{0}".format(i)} for i in (3, 4)]} ) self.assertEqual(mismatch, None)
def test_excludes_servers_failure(self): """ :class:`ExcludesServers` fails when the active list contain any or all of servers with the given IDs. """ matcher = ExcludesServers(['id1', 'id2']) self.assertNotEqual( matcher.match( {'active': [{'id': "id{0}".format(i)} for i in (1, 2)]}), "Complete match succeeds when none should be present.", None ) self.assertNotEqual( matcher.match({'active': [{'id': "id1"}]}), "Partial match succeeds when none should be present.", None )