def test_glob(self): a_1, a_2, b_1 = MockHost("a-1"), MockHost("a-2"), MockHost("b-1") aliases = resolve_alias([a_1, a_2, b_1], ["a-*"]) self.assertEqual(aliases, [a_1, a_2])
def test_resolve_direct_names(self): b = MockHost("b") hosts = resolve_alias([b], ["b"]) self.assertEqual(hosts, [b])
def test_unsatisfied_glob(self): with self.assertRaises(UnresolvableAliasError): resolve_alias([], ["a"])
def test_resolve_nothing(self): aliases = resolve_alias([], []) self.assertEqual(aliases, [])
def test_glob(self): a_1, a_2, b_1 = MockHost("a-1"), MockHost("a-2"), MockHost("b-1") aliases = resolve_alias([a_1, a_2, b_1], ["a-*"]) self.assertEqual(aliases, [a_1, a_2])
def test_unsatisfied_glob(self): with self.assertRaises(UnresolvableAliasError): resolve_alias([], ["a"])
def test_resolve_direct_names(self): b = MockHost("b") hosts = resolve_alias([b], ["b"]) self.assertEqual(hosts, [b])
def test_resolve_nothing(self): aliases = resolve_alias([], []) self.assertEqual(aliases, [])