当前位置: 首页>>代码示例>>Python>>正文


Python Profile.all方法代码示例

本文整理汇总了Python中models.profile.Profile.all方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.all方法的具体用法?Python Profile.all怎么用?Python Profile.all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.profile.Profile的用法示例。


在下文中一共展示了Profile.all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_signup_page_flow

# 需要导入模块: from models.profile import Profile [as 别名]
# 或者: from models.profile.Profile import all [as 别名]
  def test_signup_page_flow(self):
    # Check that things are empty
    self.assertLength(0, Profile.all())

    # Sign up with the form
    response = self.app.post(self.uri_for('signup'), self.SIGNUP_DATA)
    self.assertRedirects(response, self.uri_for('dashboard', tour=''))

    # Check that we are actually logged in
    response = self.app.get(response.location)
    self.assertLoggedIn()

    # Check that one of everything was created
    self.assertLength(1, Profile.all())

    profile = Profile.all().get()

    # Check the basic data
    self.assertEqual(self.SIGNUP_DATA['email'], profile.email)
    self.assertEqual(self.SIGNUP_DATA['name'], profile.name)

    # Logout and log back in to test that the password works
    self.logout()
    response = self.login(self.SIGNUP_DATA['email'],
                          self.SIGNUP_DATA['password'])
    self.assertRedirects(response, self.uri_for('dashboard'))
开发者ID:carylF,项目名称:Caryl-Ford,代码行数:28,代码来源:test_signup.py

示例2: test_signup_with_existing_email

# 需要导入模块: from models.profile import Profile [as 别名]
# 或者: from models.profile.Profile import all [as 别名]
  def test_signup_with_existing_email(self):
    response = self.app.post(self.uri_for('signup'), self.SIGNUP_DATA)
    self.assertRedirects(response)
    self.assertLength(1, Profile.all())

    response = self.app.post(self.uri_for('signup'), self.SIGNUP_DATA)
    self.assertOk(response)
    self.assertLength(1, Profile.all())

    email_field = response.pyquery('input#email')
    self.assertLength(1, email_field)
    self.assertNotEqual('', email_field.attr['data-error'])
开发者ID:carylF,项目名称:Caryl-Ford,代码行数:14,代码来源:test_signup.py

示例3: test_signup_sends_welcome_email

# 需要导入模块: from models.profile import Profile [as 别名]
# 或者: from models.profile.Profile import all [as 别名]
  def test_signup_sends_welcome_email(self):
    # Sign up successfully
    response = self.app.post(self.uri_for('signup'), self.SIGNUP_DATA)
    self.assertRedirects(response, self.uri_for('dashboard', tour=''))

    # Check that a profile was created
    profile = Profile.get_by_email(self.SIGNUP_DATA['email'])
    self.assertIsNotNone(profile)

    # Check that a mail-sending task is in the queue
    tasks = self.taskqueue_stub.GetTasks('mail')
    self.assertLength(1, tasks)

    # Run the task (it should be a deferred call) and check that an e-mail
    # is sent
    task, = tasks
    deferred.run(base64.b64decode(task['body']))
    messages = self.mail_stub.get_sent_messages()
    self.assertLength(1, messages)

    message, = messages
    self.assertEqual('"%s" <%s>' % (profile.name, profile.email), message.to)
    self.assertEqual('Welcome to Daily Meeting!', message.subject)
    self.assertEqual('"Daily Meeting" <[email protected]>',
                     message.sender)
    self.assertEqual('"Daily Meeting Support" <[email protected]>',
                     message.reply_to)
    activation_key = Profile.all().get().activation_key
    activation_url = self.uri_for('profile.activate', k=activation_key)
    self.assertIn(activation_url, message.body.decode())
    self.assertIn(activation_url, message.html.decode())
开发者ID:carylF,项目名称:Caryl-Ford,代码行数:33,代码来源:test_signup.py

示例4: get

# 需要导入模块: from models.profile import Profile [as 别名]
# 或者: from models.profile.Profile import all [as 别名]
  def get(self):	
	path = os.path.join(os.path.dirname(__file__),
	                    '../views/admin/index.html')
	
	template_values = {
		'name': self.__class__.__name__,
		'profiles': Profile.all(),
	}
	
	self.response.out.write(template.render(path, template_values))
开发者ID:ciriarte,项目名称:laundry,代码行数:12,代码来源:admin.py

示例5: get_profiles

# 需要导入模块: from models.profile import Profile [as 别名]
# 或者: from models.profile.Profile import all [as 别名]
 def get_profiles(self):
   return Profile.all().ancestor(self)
开发者ID:nardorb,项目名称:OneStop,代码行数:4,代码来源:account.py

示例6: list

# 需要导入模块: from models.profile import Profile [as 别名]
# 或者: from models.profile.Profile import all [as 别名]
 def list(self):
   editors = Profile.all().filter('is_editor = ', True)
   return self.render_to_response('editors/list.haml', {'editors': editors})
开发者ID:carylF,项目名称:Caryl-Ford,代码行数:5,代码来源:editor.py


注:本文中的models.profile.Profile.all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。