def _GetJobs(options): user = api_auth.Email() if user: query = job_module.Job.query(job_module.Job.user == user) else: query = job_module.Job.query() query = query.order(-job_module.Job.created) job_future = query.fetch_async(limit=_MAX_JOBS_TO_FETCH) count_future = query.count_async(limit=_MAX_JOBS_TO_COUNT) result = { 'jobs': [], 'count': count_future.get_result(), 'max_count': _MAX_JOBS_TO_COUNT } jobs = job_future.get_result() for job in jobs: result['jobs'].append(job.AsDict(options)) return result
def _ValidateUser(arguments): return arguments.get('user') or api_auth.Email()
def _ValidateUser(user): return user or api_auth.Email()
def testEmail_NoUser(self): self.mock_get_current_user.side_effect = oauth.InvalidOAuthParametersError self.assertIsNone(api_auth.Email())
def testEmail(self): self.mock_get_current_user.return_value = _UNAUTHORIZED_USER self.assertEqual(api_auth.Email(), '*****@*****.**')