• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python models.User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中social.tests.models.User的典型用法代码示例。如果您正苦于以下问题:Python User类的具体用法?Python User怎么用?Python User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: tearDown

 def tearDown(self):
     self.strategy = None
     User.reset_cache()
     TestUserSocialAuth.reset_cache()
     TestNonce.reset_cache()
     TestAssociation.reset_cache()
     HTTPretty.disable()
开发者ID:PublicInMotionGmbH,项目名称:python-social-auth,代码行数:7,代码来源:open_id.py


示例2: test_multiple_accounts_with_same_email

 def test_multiple_accounts_with_same_email(self):
     user1 = User(username='foobar1')
     user2 = User(username='foobar2')
     user1.email = '[email protected]'
     user2.email = '[email protected]'
     self.do_login.when.called_with(after_complete_checks=False)\
         .should.throw(AuthException)
开发者ID:devvine,项目名称:python-social-auth,代码行数:7,代码来源:pipeline_tests.py


示例3: test_multiple_accounts_with_same_email

 def test_multiple_accounts_with_same_email(self):
     user1 = User(username='foobar1')
     user2 = User(username='foobar2')
     user1.email = '[email protected]'
     user2.email = '[email protected]'
     with self.assertRaises(AuthException):
         self.do_login(after_complete_checks=False)
开发者ID:2070616d,项目名称:TP3,代码行数:7,代码来源:test_pipeline.py


示例4: test_inactive_user

 def test_inactive_user(self):
     self.strategy.set_settings({
         'SOCIAL_AUTH_INACTIVE_USER_URL': '/inactive'
     })
     User.set_active(False)
     redirect = self.do_login(after_complete_checks=False)
     expect(redirect.url).to.equal('/inactive')
开发者ID:devvine,项目名称:python-social-auth,代码行数:7,代码来源:login_test.py


示例5: setUp

 def setUp(self):
     HTTPretty.enable()
     User.reset_cache()
     TestUserSocialAuth.reset_cache()
     TestNonce.reset_cache()
     TestAssociation.reset_cache()
     self.backend = module_member('social.backends.github.GithubOAuth2')
     self.strategy = TestStrategy(self.backend, TestStorage)
     self.user = None
开发者ID:0077cc,项目名称:python-social-auth,代码行数:9,代码来源:actions.py


示例6: tearDown

 def tearDown(self):
     self.backend = None
     self.strategy = None
     self.user = None
     User.reset_cache()
     User.set_active(True)
     TestUserSocialAuth.reset_cache()
     TestNonce.reset_cache()
     TestAssociation.reset_cache()
     HTTPretty.disable()
开发者ID:0077cc,项目名称:python-social-auth,代码行数:10,代码来源:actions.py


示例7: setUp

 def setUp(self):
     HTTPretty.enable()
     User.reset_cache()
     TestUserSocialAuth.reset_cache()
     TestNonce.reset_cache()
     TestAssociation.reset_cache()
     Backend = module_member("social.backends.github.GithubOAuth2")
     self.strategy = self.strategy or TestStrategy(TestStorage)
     self.backend = Backend(self.strategy, redirect_uri="/complete/github")
     self.user = None
开发者ID:humaneu,项目名称:flask_app,代码行数:10,代码来源:actions.py


示例8: tearDown

 def tearDown(self):
     HTTPretty.disable()
     self.backend = None
     self.strategy = None
     self.name = None
     self.complete_url = None
     User.reset_cache()
     TestUserSocialAuth.reset_cache()
     TestNonce.reset_cache()
     TestAssociation.reset_cache()
     TestCode.reset_cache()
开发者ID:relsi,项目名称:w2p-social-auth,代码行数:11,代码来源:base.py


示例9: setUp

 def setUp(self):
     HTTPretty.enable()
     self.backend = module_member(self.backend_path)
     self.strategy = TestStrategy(self.backend, TestStorage)
     self.name = self.backend.name.upper().replace("-", "_")
     self.complete_url = self.strategy.build_absolute_uri(self.raw_complete_url.format(self.backend.name))
     backends = (self.backend_path, "social.tests.backends.test_broken.BrokenBackendAuth")
     self.strategy.set_settings({"SOCIAL_AUTH_AUTHENTICATION_BACKENDS": backends})
     self.strategy.set_settings(self.extra_settings())
     # Force backends loading to trash PSA cache
     load_backends(backends, force_load=True)
     User.reset_cache()
     TestUserSocialAuth.reset_cache()
     TestNonce.reset_cache()
     TestAssociation.reset_cache()
     TestCode.reset_cache()
开发者ID:relsi,项目名称:w2p-social-auth,代码行数:16,代码来源:base.py


示例10: test_disconnect_with_partial_pipeline

    def test_disconnect_with_partial_pipeline(self):
        self.strategy.set_settings({
            'SOCIAL_AUTH_DISCONNECT_PIPELINE': (
                'social.pipeline.partial.save_status_to_session',
                'social.tests.pipeline.ask_for_password',
                'social.tests.pipeline.set_password',
                'social.pipeline.disconnect.allowed_to_disconnect',
                'social.pipeline.disconnect.get_entries',
                'social.pipeline.disconnect.revoke_tokens',
                'social.pipeline.disconnect.disconnect'
            )
        })
        self.do_login()
        user = User.get(self.expected_username)
        redirect = do_disconnect(self.backend, user)

        url = self.strategy.build_absolute_uri('/password')
        expect(redirect.url).to.equal(url)
        HTTPretty.register_uri(HTTPretty.GET, redirect.url, status=200,
                               body='foobar')
        HTTPretty.register_uri(HTTPretty.POST, redirect.url, status=200)

        password = 'foobar'
        requests.get(url)
        requests.post(url, data={'password': password})
        data = parse_qs(HTTPretty.last_request.body)
        expect(data['password']).to.equal(password)
        self.strategy.session_set('password', data['password'])

        redirect = do_disconnect(self.backend, user)
        expect(len(user.social)).to.equal(0)
开发者ID:Akanksha18,项目名称:Amipool,代码行数:31,代码来源:test_disconnect.py


示例11: test_disconnect_with_association_id

 def test_disconnect_with_association_id(self):
     self.do_login()
     user = User.get(self.expected_username)
     user.password = 'password'
     association_id = user.social[0].id
     second_usa = TestUserSocialAuth(user, user.social[0].provider, "uid2")
     self.assertEqual(len(user.social), 2)
     do_disconnect(self.backend, user, association_id)
     self.assertEqual(len(user.social), 1)
     self.assertEqual(user.social[0], second_usa)
开发者ID:2070616d,项目名称:TP3,代码行数:10,代码来源:test_disconnect.py


示例12: test_revoke_token

 def test_revoke_token(self):
     self.strategy.set_settings({
         'SOCIAL_AUTH_REVOKE_TOKENS_ON_DISCONNECT': True
     })
     self.do_login()
     user = User.get(self.expected_username)
     user.password = 'password'
     HTTPretty.register_uri(self._method(self.backend.REVOKE_TOKEN_METHOD),
                            self.backend.REVOKE_TOKEN_URL,
                            status=200)
     do_disconnect(self.backend, user)
开发者ID:2070616d,项目名称:TP3,代码行数:11,代码来源:test_dummy.py


示例13: test_user_persists_in_partial_pipeline

    def test_user_persists_in_partial_pipeline(self):
        user = User(username='foobar1')
        user.email = '[email protected]'

        self.strategy.set_settings({
            'SOCIAL_AUTH_PIPELINE': (
                'social.pipeline.social_auth.social_details',
                'social.pipeline.social_auth.social_uid',
                'social.pipeline.social_auth.associate_by_email',
                'social.tests.pipeline.set_user_from_args'
            )
        })

        redirect = self.do_login(after_complete_checks=False)

        # Handle the partial pipeline
        self.strategy.session_set('attribute', 'testing')

        data = self.strategy.session_pop('partial_pipeline')

        idx, backend, xargs, xkwargs = self.strategy.partial_from_session(data)

        self.backend.continue_pipeline(pipeline_index=idx,
                                              *xargs, **xkwargs)
开发者ID:cambridgemike,项目名称:python-social-auth,代码行数:24,代码来源:test_pipeline.py


示例14: test_disconnect

 def test_disconnect(self):
     self.do_login()
     user = User.get(self.expected_username)
     user.password = 'password'
     do_disconnect(self.backend, user)
     expect(len(user.social)).to.equal(0)
开发者ID:Akanksha18,项目名称:Amipool,代码行数:6,代码来源:test_disconnect.py


示例15: test_not_allowed_to_disconnect

 def test_not_allowed_to_disconnect(self):
     self.do_login()
     user = User.get(self.expected_username)
     do_disconnect.when.called_with(self.backend, user).should.throw(
         NotAllowedToDisconnect
     )
开发者ID:Akanksha18,项目名称:Amipool,代码行数:6,代码来源:test_disconnect.py


示例16: test_not_allowed_to_disconnect

 def test_not_allowed_to_disconnect(self):
     self.do_login()
     user = User.get(self.expected_username)
     with self.assertRaises(NotAllowedToDisconnect):
         do_disconnect(self.backend, user)
开发者ID:2070616d,项目名称:TP3,代码行数:5,代码来源:test_disconnect.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.build_absolute_uri函数代码示例发布时间:2022-05-27
下一篇:
Python template.renderScriptBlock函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap