Exemplo n.º 1
0
 def test_hasObserver(self):
     obj = BaseObject()
     notificationObject = NotificationTestObserver()
     notificationCenter = NotificationCenter()
     obj._dispatcher = weakref.ref(notificationCenter)
     obj.dispatcher.addObserver(observer=notificationObject,
                                methodName="notificationCallback",
                                notification="BaseObject.Changed",
                                observable=obj)
     self.assertTrue(
         obj.hasObserver(observer=notificationObject,
                         notification="BaseObject.Changed"))
Exemplo n.º 2
0
 def test_hasObserver(self):
     obj = BaseObject()
     notificationObject = NotificationTestObserver()
     notificationCenter = NotificationCenter()
     obj._dispatcher = weakref.ref(notificationCenter)
     obj.dispatcher.addObserver(observer=notificationObject,
                                methodName="notificationCallback",
                                notification="BaseObject.Changed",
                                observable=obj)
     self.assertTrue(
         obj.hasObserver(observer=notificationObject,
                         notification="BaseObject.Changed")
     )
Exemplo n.º 3
0
 def test_addObserver(self):
     obj = BaseObject()
     notificationObject = NotificationTestObserver()
     notificationCenter = NotificationCenter()
     obj._dispatcher = weakref.ref(notificationCenter)
     obj.addObserver(observer=notificationObject,
                     methodName="notificationCallback",
                     notification="BaseObject.Changed",
                     identifier="test")
     self.assertTrue(
         obj.dispatcher.hasObserver(observer=notificationObject,
                                    notification="BaseObject.Changed",
                                    observable=obj))
     expected = [
         dict(observer=notificationObject,
              notification="BaseObject.Changed",
              observable=obj,
              identifier="test")
     ]
     result = obj.findObservations()
     self.assertEqual(expected, result)
Exemplo n.º 4
0
 def test_dispatcher(self):
     notificationCenter = NotificationCenter()
     obj = BaseObject()
     obj._dispatcher = weakref.ref(notificationCenter)
     self.assertEqual(obj.dispatcher, notificationCenter)
Exemplo n.º 5
0
 def test_dispatcher(self):
     notificationCenter = NotificationCenter()
     obj = BaseObject()
     obj._dispatcher = weakref.ref(notificationCenter)
     self.assertEqual(obj.dispatcher, notificationCenter)