Testbed stub for Google App Engine 'search'

google-app-engine, testbed

Solution

It seems that since SDK 1.8.4 the search stub can be enabled from Testbed:

from google.appengine.api import search
from google.appengine.ext import testbed

try:
    tb = testbed.Testbed()
    tb.activate()
    tb.init_search_stub()
    index = search.Index(name='test')
    index.put(search.Document())
finally:
    tb.deactivate()

Problem

I am trying to test Google App Engine's new full text search functionality in Python with the development appserver. Is there a stub for the `search` that allows one to test it with the `testbed` local unit testing? The following is example code that throws an exception: ``` #!/usr/bin/python from google.appengine.ext import testbed from google.appengine.api import search def foo(): d = search.Document(doc_id='X', fields=[search.TextField(name='abc', value='123')]) s = search.Index(name='one').add(d) tb = testbed.Testbed() tb.activate() # tb.init_search_stub() ## does this exist? foo() ``` The exception thrown by `foo()` is: `AssertionError: No api proxy found for service "search"`. Has an api proxy been written for search? Thoughts and comments appreciated.

Original source