Exemplo n.º 1
0
 def setUp(self):
     self.config = SearchConfig('foo', 'bar')
     requester = Requester()
     self.transporter = Transporter(requester, self.config)
     self.transporter.read = mock.Mock(name="read")
     self.transporter.read.return_value = {}
     self.transporter.write = mock.Mock(name="write")
     self.transporter.write.return_value = {}
     self.index = SearchIndex(self.transporter, self.config, 'index-name')
    def __init__(self, search_index, transporter, config, name):
        # type: (SearchIndex, TransporterAsync, SearchConfig, str) -> None

        self._search_index = search_index
        self._transporter_async = transporter

        super(SearchIndexAsync, self).__init__(search_index._transporter,
                                               config, name)

        search_index = SearchIndex(transporter, config, name)
        search_index.__setattr__('_sync', self._sync)

        _create_async_methods_in(self, search_index)
    def init_index(self, name):
        # type: (str) -> SearchIndex

        return SearchIndex(self._transporter, self._config, name)