本文整理汇总了Python中utils.login函数的典型用法代码示例。如果您正苦于以下问题:Python login函数的具体用法?Python login怎么用?Python login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了login函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_topic_notification_list
def test_topic_notification_list(self):
"""
topic notification list
"""
utils.login(self)
response = self.client.get(reverse('spirit:topic-notification-list'))
self.assertQuerysetEqual(response.context['notifications'], map(repr, [self.topic_notification, ]))
开发者ID:AlienTechs,项目名称:Spirit,代码行数:7,代码来源:tests_topic_notification.py
示例2: setUp
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(10)
self.base_url = "http://127.0.0.1:8000"
self.verificationErrors = []
self.accept_next_alert = True
utils.login(self.driver)
开发者ID:asifurrouf,项目名称:web-gui-test,代码行数:7,代码来源:regist_action_firefox.py
示例3: test_private_publish_user
def test_private_publish_user(self):
"""
create private topic with user as initial value
"""
utils.login(self)
response = self.client.get(reverse('spirit:private-publish', kwargs={'user_id': self.user2.pk, }))
self.assertEqual(response.context['tpform'].initial['users'], [self.user2.username, ])
开发者ID:AlienTechs,项目名称:Spirit,代码行数:7,代码来源:tests_topic_private.py
示例4: test_comment_move_signal
def test_comment_move_signal(self):
"""
move comments, emit signal
"""
self._comments = []
def comment_posted_handler(sender, comment, **kwargs):
self._comments.append(comment)
comment_posted.connect(comment_posted_handler)
def comment_moved_handler(sender, comments, topic_from, **kwargs):
self._comment_count = len(comments)
self._topic_from = topic_from
comment_moved.connect(comment_moved_handler)
utils.login(self)
self.user.is_moderator = True
self.user.save()
comment = utils.create_comment(user=self.user, topic=self.topic)
comment2 = utils.create_comment(user=self.user, topic=self.topic)
to_topic = utils.create_topic(self.category)
form_data = {'topic': to_topic.pk,
'comments': [comment.pk, comment2.pk], }
response = self.client.post(reverse('spirit:comment-move', kwargs={'topic_id': self.topic.pk, }),
form_data)
self.assertEqual(response.status_code, 302)
self.assertListEqual(self._comments, [comment2, comment])
self.assertEqual(self._comment_count, 2)
self.assertEqual(repr(self._topic_from), repr(self.topic))
开发者ID:IronLemon,项目名称:Spirit,代码行数:31,代码来源:tests_comment.py
示例5: test_private_publish_user
def test_private_publish_user(self):
"""
create private topic with user as initial value
"""
utils.login(self)
response = self.client.get(reverse("spirit:private-publish", kwargs={"user_id": self.user2.pk}))
self.assertEqual(response.context["tpform"].initial["users"], [self.user2.username])
开发者ID:Neugls,项目名称:Spirit,代码行数:7,代码来源:tests_topic_private.py
示例6: test_user_admins
def test_user_admins(self):
"""
List of admins
"""
utils.login(self)
response = self.client.get(reverse('spirit:admin-user-admins'))
self.assertQuerysetEqual(response.context['users'], map(repr, [self.user, ]))
开发者ID:MGXRace,项目名称:Spirit,代码行数:7,代码来源:tests_admin.py
示例7: test_topic_publish_invalid_category
def test_topic_publish_invalid_category(self):
"""
invalid topic category
"""
utils.login(self)
response = self.client.get(reverse('spirit:topic-publish', kwargs={'category_id': str(99), }))
self.assertEqual(response.status_code, 404)
开发者ID:MGXRace,项目名称:Spirit,代码行数:7,代码来源:tests_topic.py
示例8: main
def main():
parser = get_argparser()
args = parser.parse_args()
username = args.email
password = args.password
blacklist = ['junk', 'trash', 'drafts']
if args.ignore:
blacklist.extend([b.lower() for b in args.ignore])
if not os.path.isdir('backup'):
os.makedirs('backup')
browser = webdriver.Firefox()
try:
login(browser, username, password)
mailboxes = get_mailboxes(browser, blacklist)
print('The following folders will be backed up:')
for box in mailboxes:
print(box)
for box in mailboxes:
print('Backing %s up' % box)
fetch_emails(browser, box)
print('%s backup complete!' % box)
finally:
browser.close()
print('Backup complete!')
开发者ID:victal,项目名称:igscraper,代码行数:28,代码来源:ig_scraper.py
示例9: test_profile_likes_dont_show_removed_or_private
def test_profile_likes_dont_show_removed_or_private(self):
"""
dont show private topics or removed
"""
category = utils.create_category()
category_removed = utils.create_category(is_removed=True)
subcategory = utils.create_category(parent=category_removed)
subcategory_removed = utils.create_category(parent=category, is_removed=True)
topic_a = utils.create_private_topic(user=self.user2)
topic_b = utils.create_topic(category=category, is_removed=True)
topic_c = utils.create_topic(category=category_removed)
topic_d = utils.create_topic(category=subcategory)
topic_e = utils.create_topic(category=subcategory_removed)
comment_a = utils.create_comment(user=self.user2, topic=topic_a.topic)
comment_b = utils.create_comment(user=self.user, topic=topic_b)
comment_c = utils.create_comment(user=self.user, topic=topic_c)
comment_d = utils.create_comment(user=self.user, topic=topic_d)
comment_e = utils.create_comment(user=self.user, topic=topic_e)
like_a = CommentLike.objects.create(user=self.user2, comment=comment_a)
like_b = CommentLike.objects.create(user=self.user2, comment=comment_b)
like_c = CommentLike.objects.create(user=self.user2, comment=comment_c)
like_d = CommentLike.objects.create(user=self.user2, comment=comment_d)
like_e = CommentLike.objects.create(user=self.user2, comment=comment_e)
utils.login(self)
response = self.client.get(reverse("spirit:profile-likes", kwargs={'pk': self.user2.pk,
'slug': self.user2.slug}))
self.assertQuerysetEqual(response.context['comments'], [])
开发者ID:AlienTechs,项目名称:Spirit,代码行数:28,代码来源:tests_user.py
示例10: test_advanced_search_detail
def test_advanced_search_detail(self):
"""
advanced search by topic
"""
utils.login(self)
response = self.client.get(reverse('spirit:search'))
self.assertEqual(response.status_code, 200)
开发者ID:AlienTechs,项目名称:Spirit,代码行数:7,代码来源:tests_search.py
示例11: test_user_mods
def test_user_mods(self):
"""
List of admins
"""
mod = utils.create_user(is_moderator=True)
utils.login(self)
response = self.client.get(reverse('spirit:admin-user-mods'))
self.assertQuerysetEqual(response.context['users'], map(repr, [mod, ]))
开发者ID:MGXRace,项目名称:Spirit,代码行数:8,代码来源:tests_admin.py
示例12: test_topic_pinned
def test_topic_pinned(self):
"""
Pinned topics
"""
topic_ = utils.create_topic(self.category, is_pinned=True)
utils.login(self)
response = self.client.get(reverse('spirit:admin-topic-pinned'))
self.assertQuerysetEqual(response.context['topics'], map(repr, [topic_, ]))
开发者ID:MGXRace,项目名称:Spirit,代码行数:8,代码来源:tests_admin.py
示例13: test_register_next_logged_in
def test_register_next_logged_in(self):
"""
redirect next on register
"""
# redirect logged in user
utils.login(self)
response = self.client.get(reverse('spirit:user-register') + "?next=/fakepath/")
self.assertRedirects(response, '/fakepath/', status_code=302, target_status_code=404)
开发者ID:AlienTechs,项目名称:Spirit,代码行数:8,代码来源:tests_user.py
示例14: test_resend_activation_email_redirect_logged
def test_resend_activation_email_redirect_logged(self):
"""
resend_activation_email redirect to profile if user is logged in
"""
utils.login(self)
response = self.client.get(reverse('spirit:resend-activation'))
expected_url = reverse("spirit:profile-update")
self.assertRedirects(response, expected_url, status_code=302)
开发者ID:AlienTechs,项目名称:Spirit,代码行数:8,代码来源:tests_user.py
示例15: test_private_detail
def test_private_detail(self):
"""
private topic detail
"""
utils.login(self)
private = utils.create_private_topic(user=self.user)
response = self.client.get(reverse("spirit:private-detail", kwargs={"topic_id": private.topic.pk}))
self.assertEqual(response.context["topic"], private.topic)
开发者ID:Neugls,项目名称:Spirit,代码行数:8,代码来源:tests_topic_private.py
示例16: test_private_detail
def test_private_detail(self):
"""
private topic detail
"""
utils.login(self)
private = utils.create_private_topic(user=self.user)
response = self.client.get(reverse('spirit:private-detail', kwargs={'topic_id': private.topic.pk,
'slug': private.topic.slug}))
self.assertEqual(response.context['topic'], private.topic)
开发者ID:AlienTechs,项目名称:Spirit,代码行数:9,代码来源:tests_topic_private.py
示例17: test_topic_detail_view
def test_topic_detail_view(self):
"""
should display topic
"""
utils.login(self)
category = utils.create_category()
topic = utils.create_topic(category=category)
response = self.client.get(reverse('spirit:topic-detail', kwargs={'pk': topic.pk, }))
self.assertEqual(response.context['topic'], topic)
开发者ID:MGXRace,项目名称:Spirit,代码行数:9,代码来源:tests_topic.py
示例18: test_favorite_create_next
def test_favorite_create_next(self):
"""
create favorite using next
"""
utils.login(self)
form_data = {'next': '/fakepath/', }
response = self.client.post(reverse('spirit:favorite-create', kwargs={'topic_id': self.topic.pk, }),
form_data)
self.assertRedirects(response, '/fakepath/', status_code=302, target_status_code=404)
开发者ID:AlienTechs,项目名称:Spirit,代码行数:9,代码来源:tests_topic_favorite.py
示例19: test_category_list
def test_category_list(self):
"""
Categories, excludes Topic Private and subcats
"""
subcat = utils.create_category(parent=self.category)
categories = Category.objects.filter(is_private=False, parent=None)
utils.login(self)
response = self.client.get(reverse('spirit:admin-category-list'))
self.assertQuerysetEqual(response.context['categories'], map(repr, categories))
开发者ID:MGXRace,项目名称:Spirit,代码行数:9,代码来源:tests_admin.py
示例20: test_comment_publish_next
def test_comment_publish_next(self):
"""
next on create comment
"""
utils.login(self)
form_data = {'comment': 'foobar', 'next': '/fakepath/'}
response = self.client.post(reverse('spirit:comment-publish', kwargs={'topic_id': self.topic.pk, }),
form_data)
self.assertRedirects(response, '/fakepath/', status_code=302, target_status_code=404)
开发者ID:IronLemon,项目名称:Spirit,代码行数:9,代码来源:tests_comment.py
注:本文中的utils.login函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论