def t070_Post(self): """articoli""" L.i("PostTestData load start") nu = len( self.users) ns = len( self.sectors) if not nu: L.w("No user to use to load user post :-) ") return False if not ns: L.w("No sectors available") return False c = 0 for el in TestData.listPost: ref = list( [ x.key() for x in self.listOf( self.links, 4) ]) L.i(" Dataloaded #{0}".format(c)); c+=1; L.i(ref); post = Post( title = el['title'], tags = ["tag1", "tags2", "tag3"], sector = list( [x.key() for x in self.listOf( self.sectors,2 )] ), date = self.parseDate(el['date']), image = list( [ x.key() for x in self.listOf( self.images, 2)]), body = unicode(el['body']), author = random.choice(self.users), repositoryLink = list( [x.key() for x in self.links]), reference = ref ) post.save() L.i("PostTestData load ended") return True
def t070_Post(self): """articoli""" L.i("PostTestData load start") nu = len(self.users) ns = len(self.sectors) if not nu: L.w("No user to use to load user post :-) ") return False if not ns: L.w("No sectors available") return False c = 0 for el in TestData.listPost: ref = list([x.key() for x in self.listOf(self.links, 4)]) L.i(" Dataloaded #{0}".format(c)) c += 1 L.i(ref) post = Post( title=el['title'], tags=["tag1", "tags2", "tag3"], sector=list([x.key() for x in self.listOf(self.sectors, 2)]), date=self.parseDate(el['date']), image=list([x.key() for x in self.listOf(self.images, 2)]), body=unicode(el['body']), author=random.choice(self.users), repositoryLink=list([x.key() for x in self.links]), reference=ref) post.save() L.i("PostTestData load ended") return True
def t050_Refer(self): """I like""" L.i("ReferTestData load start") nu = len(self.users) nt = len(self.technologyEntity) c = 0 if ( nu ==0 ): L.w("No uses available to load refers") return False if ( nt == 0): L.w("No techs available for refers ") return False L.i("found {0} user and {1} technology entries".format(nu,nt)) for el in TestData.listRefer: ref = Refer( user = random.choice(self.users), technology = random.choice(self.technologyEntity), stars = el['stars'], who = random.choice(self.users), description = el['description'] ) self.refers.append(ref) ref.save() L.i(" Dataloaded #{0}".format(c)); c+=1; L.i("ReferTestData load ended") return True
def t050_Refer(self): """I like""" L.i("ReferTestData load start") nu = len(self.users) nt = len(self.technologyEntity) c = 0 if (nu == 0): L.w("No uses available to load refers") return False if (nt == 0): L.w("No techs available for refers ") return False L.i("found {0} user and {1} technology entries".format(nu, nt)) for el in TestData.listRefer: ref = Refer(user=random.choice(self.users), technology=random.choice(self.technologyEntity), stars=el['stars'], who=random.choice(self.users), description=el['description']) self.refers.append(ref) ref.save() L.i(" Dataloaded #{0}".format(c)) c += 1 L.i("ReferTestData load ended") return True