Beispiel #1
0
    def test_arbitrary_actor_method(self, meth):
        a1 = ActorProxy(qualname(As), uuid())
        a1.meth()

        meth.assert_called_once_with()
        meth.reset_mock()

        args = ['bar']

        a1.meth(*args)
        meth.assert_called_once_with(*args)
Beispiel #2
0
    def test_init(self, conn):
        """test that __init__ sets fields"""
        id = uuid()
        ag, res = Mock(), Mock()
        # we need to have wait for result,
        a1 = ActorProxy(qualname(A), id, connection=conn, agent=ag)

        self.assertEqual(a1.id, id)
        self.assertIsNone(a1.async_start_result)
        self.assertIsInstance(a1._actor, A)
        self.assertEqual(a1._actor.name, A().__class__.__name__)
        self.assertEqual(a1._actor.agent, ag)
        self.assertEqual(a1._actor.id, a1.id)
        self.assertEqual(a1._actor.connection, conn)

        a1 = ActorProxy(qualname(A), id, res, connection=conn, agent=ag)

        self.assertEqual(a1.id, id)
        self.assertEqual(a1.async_start_result, res)
        self.assertEqual(a1._actor.id, a1.id)
        self.assertIsInstance(a1._actor, A)
        self.assertEqual(a1._actor.name, A().__class__.__name__)
        self.assertEqual(a1._actor.agent, ag)
        self.assertEqual(a1._actor.connection, conn)
Beispiel #3
0
    def test_arbitrary_actor_method(self, meth):
        a1 = ActorProxy(qualname(As), uuid())
        a1.meth()

        meth.assert_called_once_with()
        meth.reset_mock()

        args = ['bar']

        a1.meth(*args)
        meth.assert_called_once_with(*args)
Beispiel #4
0
 def test_non_existing_actor_method(self):
     a1 = ActorProxy(qualname(As), uuid())
     with self.assertRaises(AttributeError):
         a1.bar()
Beispiel #5
0
 def test_non_existing_actor_method(self):
     a1 = ActorProxy(qualname(As), uuid())
     with self.assertRaises(AttributeError):
         a1.bar()
Beispiel #6
0
 def test_scatter_dot(self, scatter):
     a1 = ActorProxy(qualname(As), uuid())
     self.assert_actor_method_called_with_par_foo(scatter, a1.scatter)
Beispiel #7
0
 def test_scatter(self, scatter):
     a1 = ActorProxy(qualname(As), uuid())
     self.assert_actor_method_called(scatter, a1.scatter)
Beispiel #8
0
 def test_throw_dot(self, throw):
     a1 = ActorProxy(qualname(As), uuid())
     self.assert_actor_method_called_with_par_foo(throw, a1.throw)
Beispiel #9
0
 def test_throw(self, throw):
     a1 = ActorProxy(qualname(As), uuid())
     self.assert_actor_method_called(throw, a1.throw)
Beispiel #10
0
 def test_send_dot(self, send):
     a1 = ActorProxy(qualname(As), uuid())
     self.assert_actor_method_called_with_par_foo(send, a1.send)
Beispiel #11
0
 def test_send(self, send):
     a1 = ActorProxy(qualname(As), uuid())
     self.assert_actor_method_called(send, a1.send)
Beispiel #12
0
 def test_call(self, call):
     a1 = ActorProxy(qualname(As), uuid())
     self.assert_actor_method_called(call, a1.call)
Beispiel #13
0
 def test_call_dot(self, call):
     a1 = ActorProxy(qualname(As), uuid)
     self.assert_actor_method_called_with_par_foo(call, a1.call)