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
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
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
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 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 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 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)