Skip to content

Commit

Permalink
add missing support for enabling search service stub in Testbed
Browse files Browse the repository at this point in the history
  • Loading branch information
embray authored and shreejad committed Jun 13, 2023
1 parent dc77b80 commit 31ceb17
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/google/appengine/ext/testbed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def testInsertEntity(self):
from google.appengine.api.modules import modules_stub
from google.appengine.api.namespace_manager import namespace_manager
from google.appengine.api.oauth import oauth_api
from google.appengine.api.search import simple_search_stub
from google.appengine.api.taskqueue import taskqueue_stub
from google.appengine.datastore import cloud_datastore_v1_stub
from google.appengine.datastore import datastore_pbs
Expand Down Expand Up @@ -212,6 +213,7 @@ def testInsertEntity(self):
IMAGES_SERVICE_NAME = 'images'
MAIL_SERVICE_NAME = 'mail'
MEMCACHE_SERVICE_NAME = 'memcache'
SEARCH_SERVICE_NAME = 'search'
TASKQUEUE_SERVICE_NAME = 'taskqueue'
URLFETCH_SERVICE_NAME = 'urlfetch'
USER_SERVICE_NAME = 'user'
Expand Down Expand Up @@ -933,6 +935,21 @@ def init_xmpp_stub(self, enable=True):
"""
raise StubNotSupportedError('The xmpp stub is not supported in Titanoboa.')

def init_search_stub(self, enable=True, **stub_kw_args):
"""Enables the search stub.
Args:
enable: `True` if the fake service should be enabled, or `False` if the
real service should be disabled.
**stub_kw_args: Keyword arguments that are passed on to the service
stub.
"""
if not enable:
self._disable_stub(SEARCH_SERVICE_NAME)
return
stub = simple_search_stub.SearchServiceStub(**stub_kw_args)
self._register_stub(SEARCH_SERVICE_NAME, stub)

def init_modules_stub(self, enable=True):
"""Enables the modules stub.
Expand Down

0 comments on commit 31ceb17

Please sign in to comment.