| Index: chrome/common/extensions/docs/server2/appengine_wrappers.py
|
| diff --git a/chrome/common/extensions/docs/server2/appengine_wrappers.py b/chrome/common/extensions/docs/server2/appengine_wrappers.py
|
| index 7fcb7159d5dd3330c8715a3023751e6201369a44..b0b65df137e773bdde12b869d164c4c67d5ea42f 100644
|
| --- a/chrome/common/extensions/docs/server2/appengine_wrappers.py
|
| +++ b/chrome/common/extensions/docs/server2/appengine_wrappers.py
|
| @@ -5,22 +5,20 @@
|
| # This will attempt to import the actual App Engine modules, and if it fails,
|
| # they will be replaced with fake modules. This is useful during testing.
|
| try:
|
| + import google.appengine.ext.blobstore as blobstore
|
| + from google.appengine.ext.blobstore.blobstore import BlobReferenceProperty
|
| + import google.appengine.ext.db as db
|
| import google.appengine.ext.webapp as webapp
|
| + import google.appengine.api.files as files
|
| import google.appengine.api.memcache as memcache
|
| import google.appengine.api.urlfetch as urlfetch
|
| except ImportError:
|
| - class FakeUrlFetch(object):
|
| - """A fake urlfetch module that errors for all method calls.
|
| - """
|
| - def fetch(self, url):
|
| + class NotImplemented(object):
|
| + def __getattr__(self, attr):
|
| raise NotImplementedError()
|
|
|
| - def create_rpc(self):
|
| - raise NotImplementedError()
|
| -
|
| - def make_fetch_call(self):
|
| - raise NotImplementedError()
|
| - urlfetch = FakeUrlFetch()
|
| + blobstore = NotImplemented()
|
| + files = NotImplemented()
|
|
|
| class InMemoryMemcache(object):
|
| """A memcache that stores items in memory instead of using the memcache
|
| @@ -44,6 +42,28 @@ except ImportError:
|
| self._cache[namespace].pop(key)
|
| memcache = InMemoryMemcache()
|
|
|
| + class FakeUrlfetch(object):
|
| + class _RPC(object):
|
| + def wait(self):
|
| + pass
|
| +
|
| + def get_result(self):
|
| + return FakeUrlfetch._Result()
|
| +
|
| + class _Result(object):
|
| + def __init__(self):
|
| + self.content = '{ "commit": { "tree": { "sha": 0 } } }'
|
| +
|
| + def fetch(self, url):
|
| + return self._Result()
|
| +
|
| + def create_rpc(self):
|
| + return self._RPC()
|
| +
|
| + def make_fetch_call(self, rpc, url):
|
| + pass
|
| + urlfetch = FakeUrlfetch()
|
| +
|
| # A fake webapp.RequestHandler class for Handler to extend.
|
| class webapp(object):
|
| class RequestHandler(object):
|
| @@ -53,3 +73,19 @@ except ImportError:
|
|
|
| def redirect(self, path):
|
| self.request.path = path
|
| +
|
| + class _Db_Result(object):
|
| + def get(self):
|
| + return []
|
| +
|
| + class db(object):
|
| + class StringProperty(object):
|
| + pass
|
| +
|
| + class Model(object):
|
| + @staticmethod
|
| + def gql(*args):
|
| + return _Db_Result()
|
| +
|
| + class BlobReferenceProperty(object):
|
| + pass
|
|
|