Beispiel #1
0
 def getBoy(self, key):
     # first see if the user logged in:
     user = users.get_current_user()
     if user:
         q = Boy.query()
         #schools = q.fetch(10)
         boys, nextCursor, more = q.fetch_page(3)
         #return json.dumps(boys);
         return boys;
     else:
         return [] # return empty list
Beispiel #2
0
 def testProperties(self):
     boy = Boy()
     # email test
     boy.email="*****@*****.**"
     boy.level="a"
     boy.put()
     boys = Boy.query().fetch(2)
     self.assertEqual(1, len(boys))
     # test the email
     self.assertEqual('*****@*****.**', boys[0].email)
     #level test
     self.assertEqual('a', boys[0].level)
Beispiel #3
0
def createDb():
    qSchools = School.query()
    schools = qSchools.fetch(2)
    if len(schools) == 0:
        for i in range(0,50):
            school = School()
            school.name='School '+str(i)
            school.put()
    qBoys = Boy.query()
    boys = qBoys.fetch(2)
    if len(boys) == 0:
        for i in range(0,50):
            boy = Boy()
            boy.name='Boy '+str(i)
            boy.put()
Beispiel #4
0
 def testInsertEntity(self):
     Boy().put()
     self.assertEqual(1, len(Boy.query().fetch(2)))
Beispiel #5
0
 def testCreateBoys(self):
     # creates 10 boys by default:
     DbManager().createBoys()
     self.assertEqual(10, len(Boy.query().fetch(10)))