def setUp(self): # Note that you're calling super on MyTestCase, not # on DataStoreTestCase! super(Data_ModelTest, self).setUp() # Populate test entities here along with other setup. data_model = Data_Model() data_model.put_data('setup_01') self.setup_key = data_model.get_key()
class Cms(webapp2.RequestHandler): def __init__(self, request, response, **kwargs): # webapp2.RequestHandler.__init__(self, request, response, **kwargs) self.initialize(request, response, **kwargs) self.data_model = Data_Model() def get(self): self.response.headers["Content-Type"] = "text/html" name = self.request.get("name", "World") self.response.write("<html><body>Hello, %s!</body></html>" % name) self.save_name(name) def save_name(self, name): self.data_model.put_data(name)
class Cms(webapp2.RequestHandler): def __init__(self, request, response, **kwargs): #webapp2.RequestHandler.__init__(self, request, response, **kwargs) self.initialize(request, response, **kwargs) #root_model = Root_Model() #self.rkey=root_model.put_data('this is root one') self.data_model = Data_Model(parent=Data_Model.get_url_key('ag5kZXZ-ZGVidWdkdWRlN3IXCxIKUm9vdF9Nb2RlbBiAgICAgOD_CQw')) def get(self): self.response.headers['Content-Type'] = 'text/html' name = self.request.get('name', 'World') self.save_name(name) self.response.write("<html><body>") self.response.write("<br><br>Hello, %s!</body></html>" % name) def save_name(self, name): self.data_model.put_data(name) def get_names(self, key): res='' names = Data_Model.query_model(key).fetch(20) for nm in names: res=res+'<blockquote>%s</blockquote>' % nm.name return res
def __init__(self, request, response, **kwargs): # webapp2.RequestHandler.__init__(self, request, response, **kwargs) self.initialize(request, response, **kwargs) self.data_model = Data_Model()
def test_saved_enitity(self): """This is test saved entity""" data_model = Data_Model() data_model.put_data('setup_02') key = data_model.get_key() self.assertEqual('setup_02', key.get().name)
def __init__(self, request, response, **kwargs): #webapp2.RequestHandler.__init__(self, request, response, **kwargs) self.initialize(request, response, **kwargs) #root_model = Root_Model() #self.rkey=root_model.put_data('this is root one') self.data_model = Data_Model(parent=Data_Model.get_url_key('ag5kZXZ-ZGVidWdkdWRlN3IXCxIKUm9vdF9Nb2RlbBiAgICAgOD_CQw'))
def get_names(self, key): res='' names = Data_Model.query_model(key).fetch(20) for nm in names: res=res+'<blockquote>%s</blockquote>' % nm.name return res
def set_up(self): # Populate test entities here along with other setup. data_model = Data_Model() data_model.put_data('setup_01') self.setup_key = data_model.get_key()