def testDaoSaveService(self): data={'name':'web develop','description':'this service is to create web'} DAO().saveService(data) q = Service.query() services=q.fetch() self.assertEqual(1, len(services)) self.assertEqual('web develop', services[0].name)
def createCompanyServices(self, num=10): txt = """ this text for description for the service. """ for i in range(0, num): """ if i%2 == 0: websites = [] elif i%3 == 0: websites = ['web'+str(i),'web'+str(i+1)] else: websites = ['web'+str(i)] """ service = Service(name="Service " + str(i), description=txt) # project.name='Project '+str(i) # project.created=datetime.datetime.now() service.put()
def testCreateServices(self): DbManager().createCompanyServices() services = Service.query().fetch(10) self.assertEqual(10, len(services)) # test the description: txt1=services[0].description txt2=''' this text for description for the service. ''' self.assertEqual(txt1, txt2)
def addService(self, boisson, quantite): cuve = self.getCuveFromBoisson(boisson) new = Service(boisson, cuve, quantite) self.services.append(new)
def getServices(self): q = Service.query() services, nextCursor, more = q.fetch_page(20) return services
def saveService(self, data): service = Service(name=data['name'], description=data['description']) service.put()
def saveService(self, data): ''' for services offered by company ''' service = Service(name=data['name'], description=data['description']) service.put()