Skip to content

Instantly share code, notes, and snippets.

@lattejed
Created October 4, 2010 17:49
Show Gist options
  • Save lattejed/610134 to your computer and use it in GitHub Desktop.
Save lattejed/610134 to your computer and use it in GitHub Desktop.
# Import AE's api stubs
from google.appengine.api import apiproxy_stub_map
from google.appengine.api import datastore_file_stub
from google.appengine.api import mail_stub
from google.appengine.api import urlfetch_stub
from google.appengine.api import user_service_stub
# Set up our dummy environment
APP_ID = 'test_app'
AUTH_DOMAIN = 'gmail.com'
LOGGED_IN_USER = 't...@example.com' # set to '' for no logged in user
os.environ['AUTH_DOMAIN'] = AUTH_DOMAIN
os.environ['USER_EMAIL'] = LOGGED_IN_USER
os.environ['APPLICATION_ID'] = APP_ID
apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
stub = datastore_file_stub.DatastoreFileStub(APP_ID, '/dev/null', '/dev/null')
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', stub)
apiproxy_stub_map.apiproxy.RegisterStub('user', user_service_stub.UserServiceStub())
apiproxy_stub_map.apiproxy.RegisterStub('urlfetch', urlfetch_stub.URLFetchServiceStub())
apiproxy_stub_map.apiproxy.RegisterStub('mail', mail_stub.MailServiceStub())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment