0

I have basically the same question as Testbed stub for Google App Engine 'search' but for the 'prospective search' service.

I am trying to do some unit testing for my app which uses prospective search, and I'm getting:

AssertionError: No api proxy found for service "matcher"

I have looked at the list of supported stubs, the docs, and the issue tracker, but I have found no reference to anything useful.

Community
  • 1
  • 1
payala
  • 1,357
  • 13
  • 28

1 Answers1

0

The accepted answer on Testbed stub for Google App Engine 'search' already points in the right direction, once you find the stub for prospective search.

Such stub can be found in google.appengine.api.prospective_search.prospective_search_stub

I chose to modify SUPPORTED_SERVICES list in my code, so that future updates to the SDK don't break this. Although I agree that any solution is a hack anyways.

So it all ends up like this.

In the test module:

from google.appengine.ext import testbed
    #Workaround to avoid prospective search complain until there is a proper
    #testbed stub
from google.appengine.api.prospective_search.prospective_search_stub \
    import ProspectiveSearchStub
PROSPECTIVE_SEARCH_SERVICE_NAME = "matcher"
testbed.SUPPORTED_SERVICES.append(PROSPECTIVE_SEARCH_SERVICE_NAME)

And in def setUp(self):

ps_stub = ProspectiveSearchStub('./ps.txt', None)
self.testbed._register_stub(PROSPECTIVE_SEARCH_SERVICE_NAME, ps_stub)
Community
  • 1
  • 1
payala
  • 1,357
  • 13
  • 28