Ejemplo n.º 1
0
    def setUpClass(cls):
        class TestStreamClient(stream.StreamClient):
            @classmethod
            def _create(cls, _value, **kwargs):
                return cls(**kwargs)

            def _connect_raw(self):
                class fakeFile(object):
                    def write(self, data):
                        pass

                return fakeFile()

        cls.reg = stream.StreamProtocolRegistry()
        cls.reg.register_protocol('test', TestStreamClient)
Ejemplo n.º 2
0
    def testCreateStreamClient(self):
        class TestStreamClient(stream.StreamClient):
            @classmethod
            def _create(cls, _value, **kwargs):
                return cls(**kwargs)

            def _connect_raw(self):
                raise NotImplementedError()

        reg = stream.StreamProtocolRegistry()
        reg.register_protocol('test', TestStreamClient)
        bs = bootstrap.ButlerBootstrap(project='test-project',
                                       prefix='foo/bar',
                                       streamserver_uri='test:',
                                       coordinator_host='example.appspot.com')
        sc = bs.stream_client(reg=reg)
        self.assertEqual(sc.prefix, 'foo/bar')
        self.assertEqual(sc.coordinator_host, 'example.appspot.com')
Ejemplo n.º 3
0
 def setUp(self):
   self._registry = stream.StreamProtocolRegistry()
   self._registry.register_protocol('test', self._TestStreamClient)