예제 #1
0
파일: tests.py 프로젝트: 1stvamp/pubbot
 def test_parenting_and_deparenting(self):
     p = BaseService("parent")
     c = BaseService("child")
     p.add_child(c)
     self.assertEqual(len(p.keys()), 1)
     c.disown_parent()
     self.assertEqual(len(p.keys()), 0)
예제 #2
0
파일: tests.py 프로젝트: 1stvamp/pubbot
    def test_stop_service_with_child(self):
        class C(BaseService):
            _outcome = 0

            def stop_service(self):
                self._outcome = 1

        p = BaseService("parent")
        c = C("child")
        p.add_child(c)
        p.start()
        self.assertEqual(c._outcome, 0)
        p.stop()
        self.assertEqual(c._outcome, 1)
예제 #3
0
파일: tests.py 프로젝트: 1stvamp/pubbot
 def test_double_add_child_fails(self):
     p = BaseService("parent")
     c = BaseService("child")
     p.add_child(c)
     self.assertRaises(KeyError, p.add_child, c)