Пример #1
0
 def test_provider_query(self):
     p = GoogleUserProfile()
     qry = GoogleUserProfile.query().fetch()
     self.assertEqual(len(qry), 0)
     p.put()
     # query UserProfile
     qry = UserProfile.query().fetch()
     self.assertEqual(len(qry), 1)
     qry = GoogleUserProfile.query().fetch()
     self.assertEqual(len(qry), 1)
Пример #2
0
 def test_handle_request(self):
     # No User or Profile
     p_count0 = UserProfile.query().count()
     u_count0 = User.query().count()
     self.assertEqual(p_count0, 0)
     self.assertEqual(u_count0, 0)
     # Create New User
     provider = 'gmail.com'
     req = Request.blank('/auth/appengine_openid?provider=' + provider)
     resp = req.get_response(application)
     self.assertEqual(resp.location, 'https://www.google.com/accounts/'
                                     'Login?continue=http%3A//localhost/'
                                     'auth/appengine_openid/callback')
Пример #3
0
 def test_method_call_on_subclass(self):
     p = GoogleUserProfile()
     p.put()
     pq = UserProfile.query().get()
     v = pq.test_method_call()
     self.assertEqual(v, 'it worked.')