コード例 #1
0
class StateStreamTestCase(unittest.TestCase):
    object = None  # should be set in subclass setUp

    def setUpForObject(self, obj):
        # pylint: disable=attribute-defined-outside-init
        self.object = obj
        self.updates = []
        self.st = SubscriptionTester()

        def send(value):
            self.updates.extend(json.loads(value))

        self.stream = StateStreamInner(send,
                                       self.object,
                                       'urlroot',
                                       subscription_context=self.st.context)

    def getUpdates(self):
        # pylint: disable=attribute-defined-outside-init

        self.st.advance()
        self.stream._flush()  # warning: implementation poking
        u = self.updates
        self.updates = []
        return u
コード例 #2
0
ファイル: test_export_ws.py プロジェクト: kkndyu/shinysdr
class StateStreamTestCase(unittest.TestCase):
    object = None  # should be set in subclass setUp

    def setUpForObject(self, obj):
        # pylint: disable=attribute-defined-outside-init
        self.object = obj
        self.updates = []
        self.poller = Poller()

        def send(value):
            self.updates.extend(json.loads(value))

        self.stream = StateStreamInner(
            send,
            self.object,
            'urlroot',
            lambda: None,  # TODO test noteDirty or make it unnecessary
            poller=self.poller)

    def getUpdates(self):
        # pylint: disable=attribute-defined-outside-init

        # warning: implementation poking
        self.poller.poll()
        self.stream._flush()
        u = self.updates
        self.updates = []
        return u
コード例 #3
0
class StateStreamTestCase(unittest.TestCase):
    object = None  # should be set in subclass setUp
    
    def setUpForObject(self, obj):
        # pylint: disable=attribute-defined-outside-init
        self.object = obj
        self.updates = []
        self.st = SubscriptionTester()
        
        def send(value):
            self.updates.extend(json.loads(value))
        
        self.stream = StateStreamInner(
            send,
            self.object,
            'urlroot',
            subscription_context=self.st.context)
    
    def getUpdates(self):
        # pylint: disable=attribute-defined-outside-init
        
        self.st.advance()
        self.stream._flush()  # warning: implementation poking
        u = self.updates
        self.updates = []
        return u
コード例 #4
0
    def setUpForObject(self, obj):
        # pylint: disable=attribute-defined-outside-init
        self.object = obj
        self.updates = []
        self.st = SubscriptionTester()

        def send(value):
            self.updates.extend(json.loads(value))

        self.stream = StateStreamInner(send,
                                       self.object,
                                       'urlroot',
                                       subscription_context=self.st.context)
コード例 #5
0
ファイル: test_export_ws.py プロジェクト: kkndyu/shinysdr
    def setUpForObject(self, obj):
        # pylint: disable=attribute-defined-outside-init
        self.object = obj
        self.updates = []
        self.poller = Poller()

        def send(value):
            self.updates.extend(json.loads(value))

        self.stream = StateStreamInner(
            send,
            self.object,
            'urlroot',
            lambda: None,  # TODO test noteDirty or make it unnecessary
            poller=self.poller)
コード例 #6
0
 def setUpForObject(self, obj):
     # pylint: disable=attribute-defined-outside-init
     self.object = obj
     self.updates = []
     self.st = SubscriptionTester()
     
     def send(value):
         self.updates.extend(json.loads(value))
     
     self.stream = StateStreamInner(
         send,
         self.object,
         'urlroot',
         subscription_context=self.st.context)
コード例 #7
0
    def setUpForObject(self, obj):
        # pylint: disable=attribute-defined-outside-init
        self.object = obj
        self.updates = []
        self.st = SubscriptionTester()

        def send(value):
            if isinstance(value, unicode):
                self.updates.extend(json.loads(value))
            elif isinstance(value, bytes):
                self.updates.append(['actually_binary', value])

        self.stream = StateStreamInner(send,
                                       self.object,
                                       'urlroot',
                                       subscription_context=self.st.context)