示例#1
0
 def test_default_selector_when_defined_in_profile(self):
     self.assertEqual(
         Ads(Project("test", "/test", some_services, []),
             Profile([], "c"))
         .resolve("default"),
         frozenset(["c"]))
     pass
示例#2
0
 def test_selector_resolves_to_nonexistent_service(self):
     ads = Ads(
         Project("test", "/test", [],
                 [ServiceSet("ab", frozenset(["a", "b"]))]))
     self.assertRaisesRegexp(BadSelectorException, "No service .* ab -> a",
                             ads.resolve, "ab")
     pass
示例#3
0
 def test_when_same_set_in_project_and_profile_the_latter_wins(self):
     self.assertEqual(
         Ads(Project("test", "/test", some_services, [a_and_b]),
             Profile([ServiceSet("a-and-b", frozenset(["a", "c"]))]))
         .resolve("a-and-b"),
         frozenset(["a", "c"]))
     pass
示例#4
0
 def test_recursive_selectors_across_project_and_profile(self):
     self.assertEqual(
         Ads(Project("test", "/test", some_services,
                     [ServiceSet("team-foo", frozenset(["ab", "d"]))]),
             Profile([ServiceSet("ab", frozenset(["a", "b"]))]))
         .resolve("team-foo"),
         frozenset(["a", "b", "d"]))
     pass
示例#5
0
 def test_circular_selectors(self):
     ads = Ads(Project("test", "/test", some_services,
                       [ServiceSet("foo", frozenset(["bar"]))]),
               Profile([ServiceSet("bar", frozenset(["foo"]))]))
     self.assertRaisesRegex(
         BadSelectorException, "foo -> bar -> foo", ads.resolve, "foo")
     self.assertRaisesRegex(
         BadSelectorException, "bar -> foo -> bar", ads.resolve, "bar")
     pass
示例#6
0
 def test_unknown_selector(self):
     ads = Ads(Project("test", "/test"))
     self.assertRaisesRegexp(BadSelectorException, "No service",
                             ads.resolve, "ab")
     pass
示例#7
0
 def test_set_defined_in_profile(self):
     self.assertEqual(
         Ads(Project("test", "/test", some_services),
             Profile([b_and_c])).resolve("b-and-c"), frozenset(["b", "c"]))
示例#8
0
 def test_set_defined_in_project(self):
     self.assertEqual(
         Ads(Project("test", "/test", some_services,
                     [a_and_b])).resolve("a-and-b"), frozenset(["a", "b"]))
示例#9
0
 def test_all_selector(self):
     self.assertEqual(
         Ads(Project("test", "/test", some_services)).resolve("all"),
         frozenset(["a", "b", "c", "d"]))
示例#10
0
 def test_selector_is_service_name(self):
     self.assertEqual(
         Ads(Project("test", "/test", some_services)).resolve("b"),
         frozenset(["b"]))