Wednesday 21 May 2008

Getting fresh datastore while testing GAE apps

If you want to find out how to test you GAE apps, check out these two URLs first:
http://groups.google.com/group/google-appengine/msg/9132b44026040498
http://farmdev.com/thoughts/45/testing-google-app-engine-sites/

I want to show you how to clear the datastore quickly (yep, only that :>):


from google.appengine.api import apiproxy_stub_map

def clear_datastore():
datastore = apiproxy_stub_map.apiproxy.GetStub('datastore_v3')
datastore.Clear()

1 comment:

N1YWB said...

I get:
Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 499, in __call__
handler.get(*groups)
File "/base/data/home/apps/trackulator/1.34/trackulator.py", line 111, in get
datastore.Clear()
AttributeError: 'module' object has no attribute 'Clear'