OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 import sys |
| 4 import os |
| 5 |
| 6 APPENGINE_DIR = os.path.realpath( |
| 7 os.path.join(os.environ['APPENGINE_DART_API_SERVER_EXE'], '..')) |
| 8 sys.path = [APPENGINE_DIR] + sys.path |
| 9 |
| 10 |
| 11 def setup_pythonpath(): |
| 12 import wrapper_util |
| 13 |
| 14 _PATHS = wrapper_util.Paths(APPENGINE_DIR) |
| 15 |
| 16 script_name = 'remote_api_shell.py' |
| 17 sys.path = (_PATHS.script_paths(script_name) + |
| 18 _PATHS.scrub_path(script_name, sys.path)) |
| 19 if 'google' in sys.modules: |
| 20 del sys.modules['google'] |
| 21 |
| 22 |
| 23 def configure_remote_api(servername, appid): |
| 24 from google.appengine.ext.remote_api import remote_api_stub |
| 25 from google.appengine.tools import appengine_rpc |
| 26 |
| 27 def auth_func(): |
| 28 raise Exception('Did not expect to get an authentication callback') |
| 29 |
| 30 remote_api_stub.ConfigureRemoteApi( |
| 31 appid, '/_ah/remote_api', auth_func, servername=servername, |
| 32 save_cookies=True, secure=False, |
| 33 rpc_server_factory=appengine_rpc.HttpRpcServer) |
| 34 |
| 35 |
| 36 def main(argv): |
| 37 setup_pythonpath() |
| 38 |
| 39 servername = '127.0.0.1:4444' |
| 40 appid = 'dev~test-application' |
| 41 configure_remote_api(servername, appid) |
| 42 |
| 43 if len(argv) != 2 or argv[1] not in ('read', 'write'): |
| 44 print 'usage: %s <read|write>' % argv[0] |
| 45 sys.exit(1) |
| 46 |
| 47 import main |
| 48 is_writing = argv[1] == 'write' |
| 49 main.runTests(is_writing) |
| 50 |
| 51 if __name__ == '__main__': |
| 52 main(sys.argv) |
| 53 |
OLD | NEW |