~facundo/+junk/twisted-py3k

« back to all changes in this revision

Viewing changes to twisted/test/test_jelly.py

  • Committer: exarkun
  • Date: 2011-03-15 00:19:55 UTC
  • Revision ID: svn-v4:bbbe8e31-12d6-0310-92fd-ac37d47ddeeb:trunk:31091
Merge implicit-jelly-555

Author: aruse
Reviewer: djfroofy
Fixes: #555

Change `Referenceable` to return a list from its `jellyFor` method so that
the result can be unjellied without travelling through banana.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
from twisted.spread import jelly, pb
16
16
from twisted.python.compat import set, frozenset
17
 
 
18
17
from twisted.trial import unittest
19
 
 
 
18
from twisted.test.proto_helpers import StringTransport
20
19
 
21
20
 
22
21
class TestNode(object, jelly.Jellyable):
587
586
            self._check_newstyle(x, y)
588
587
 
589
588
 
 
589
    def test_referenceable(self):
 
590
        """
 
591
        A L{pb.Referenceable} instance jellies to a structure which unjellies to
 
592
        a L{pb.RemoteReference}.  The C{RemoteReference} has a I{luid} that
 
593
        matches up with the local object key in the L{pb.Broker} which sent the
 
594
        L{Referenceable}.
 
595
        """
 
596
        ref = pb.Referenceable()
 
597
        jellyBroker = pb.Broker()
 
598
        jellyBroker.makeConnection(StringTransport())
 
599
        j = jelly.jelly(ref, invoker=jellyBroker)
 
600
 
 
601
        unjellyBroker = pb.Broker()
 
602
        unjellyBroker.makeConnection(StringTransport())
 
603
 
 
604
        uj = jelly.unjelly(j, invoker=unjellyBroker)
 
605
        self.assertIn(uj.luid, jellyBroker.localObjects)
 
606
 
 
607
 
590
608
 
591
609
class ClassA(pb.Copyable, pb.RemoteCopy):
592
610
    def __init__(self):