Created
December 20, 2011 22:32
-
-
Save mentat/1503604 to your computer and use it in GitHub Desktop.
Patch testbed to include search service stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /google_appengine.old/google/appengine/ext/testbed/__init__.py 2011-12-12 13:12:00.000000000 -0600 | |
+++ /google_appengine.new/google/appengine/ext/testbed/__init__.py 2011-12-20 16:25:45.000000000 -0600 | |
@@ -125,6 +125,8 @@ | |
from google.appengine.api.memcache import memcache_stub | |
from google.appengine.api.taskqueue import taskqueue_stub | |
from google.appengine.api.xmpp import xmpp_service_stub | |
+from google.appengine.api.search import simple_search_stub | |
+ | |
try: | |
from google.appengine.datastore import datastore_sqlite_stub | |
except ImportError: | |
@@ -162,6 +164,7 @@ | |
URLFETCH_SERVICE_NAME = 'urlfetch' | |
USER_SERVICE_NAME = 'user' | |
XMPP_SERVICE_NAME = 'xmpp' | |
+SEARCH_SERVICE_NAME = 'search' | |
SUPPORTED_SERVICES = [BLOBSTORE_SERVICE_NAME, | |
@@ -174,6 +177,7 @@ | |
URLFETCH_SERVICE_NAME, | |
USER_SERVICE_NAME, | |
XMPP_SERVICE_NAME, | |
+ SEARCH_SERVICE_NAME | |
] | |
@@ -418,7 +422,21 @@ | |
raise StubNotSupportedError(msg) | |
stub = images_stub.ImagesServiceStub() | |
self._register_stub(IMAGES_SERVICE_NAME, stub) | |
+ | |
+ | |
+ def init_search_stub(self, enable=True): | |
+ """Enable the search stub. | |
+ Args: | |
+ enable: True, if the fake service should be enabled, False if real | |
+ service should be disabled. | |
+ """ | |
+ if not enable: | |
+ self._disable_stub(SEARCH_SERVICE_NAME) | |
+ return | |
+ stub = simple_search_stub.SearchServiceStub() | |
+ self._register_stub(SEARCH_SERVICE_NAME, stub) | |
+ | |
def init_mail_stub(self, enable=True, **stub_kw_args): | |
"""Enable the mail stub. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment