Exemple #1
0
 def test_links_reply_if_match(self):
     s = StateDouble()
     c = LinksResponder(s)
     c.callback_links((3,6), (1, None), "foobar.example.com")
     self.assertEquals(
         [
             (
                 (1,None),
                 "365",
                 (3,6),
                 ["foobar.example.com", "End of /LINKS list."]
             )
         ],
         s.insight
     )
Exemple #2
0
 def test_links_reply_long(self):
     s = StateDouble()
     c = LinksResponder(s)
     s.servers[1].children = set([2])
     s.servers[2] = Server(1, 2, "test2.example.com", 1234, 1234, 1234,
                           "P10", 0, [], "A test description2")
     s.servers[2].children = set([3])
     s.servers[3] = Server(2, 3, "test3.example.com", 1234, 1234, 1234,
                           "P10", 0, [], "A test description3")
     c.callback_links((3,6), (1, None), "*")
     self.assertEquals(
         [
             (
                 (1,None),
                 "364",
                 (3,6),
                 [
                     "test.example.com",
                     "test.example.com",
                     "0 P10 A test description"
                 ]
             ), (
                 (1,None),
                 "364",
                 (3,6),
                 [
                     "test2.example.com",
                     "test.example.com",
                     "0 P10 A test description2"
                 ]
             ), (
                 (1,None),
                 "364",
                 (3,6),
                 [
                     "test3.example.com",
                     "test2.example.com",
                     "0 P10 A test description3"
                 ]
             ), (
                 (1,None),
                 "365",
                 (3,6),
                 ["*", "End of /LINKS list."]
             )
         ],
         s.insight
     )
Exemple #3
0
 def test_links_reply(self):
     s = StateDouble()
     c = LinksResponder(s)
     c.callback_links((3,6), (1, None), "*")
     self.assertEquals(
         [
             (
                 (1,None),
                 "364",
                 (3,6),
                 [
                     "test.example.com",
                     "test.example.com",
                     "0 P10 A test description"
                 ]
             ), (
                 (1,None),
                 "365",
                 (3,6),
                 ["*", "End of /LINKS list."]
             )
         ],
         s.insight
     )
Exemple #4
0
 def test_links_reply_if_relevant(self):
     s = StateDouble()
     c = LinksResponder(s)
     c.callback_links((7,6), (2, None), "*")
     self.assertEquals([], s.insight)