我正在尝试使用开发应用程序服务器测试Google App Engine的新的全文搜索功能。Google App Engine的测试存根“搜索”
search
是否有一个存根,允许用testbed
本地单元测试来测试它?
下面是示例代码抛出异常:
#!/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()
通过foo()
引发的异常是:AssertionError: No api proxy found for service "search"
。是否已经为搜索编写了api代理?
思考和评论表示赞赏。
通过@ siebz0r答案是对这个问题的读者,前进最好的一个,所以我将其标记为正确。虽然这个答案在过渡期间很棒。干杯。 –