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

Python fake.md5函数代码示例

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

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



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

示例1: test_make_response_from_ticket_invalidates_verification_key

 def test_make_response_from_ticket_invalidates_verification_key(self, mock_service_validate):
     self.user.verification_key = fake.md5()
     self.user.save()
     mock_response = make_successful_response(self.user)
     mock_service_validate.return_value = mock_response
     ticket = fake.md5()
     service_url = 'http://accounts.osf.io/?ticket=' + ticket
     resp = cas.make_response_from_ticket(ticket, service_url)
开发者ID:AllisonLBowers,项目名称:osf.io,代码行数:8,代码来源:test_cas_authentication.py


示例2: test_make_response_from_ticket_invalidates_verification_key

 def test_make_response_from_ticket_invalidates_verification_key(self, mock_service_validate):
     self.user.verification_key = fake.md5()
     self.user.save()
     mock_service_validate.return_value = make_successful_response(self.user)
     ticket = fake.md5()
     service_url = 'http://localhost:5000/'
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_true(self.user.verification_key is None)
开发者ID:baylee-d,项目名称:osf.io,代码行数:8,代码来源:test_cas_authentication.py


示例3: test_make_response_from_ticket_invalidates_verification_key

 def test_make_response_from_ticket_invalidates_verification_key(self, mock_service_validate):
     self.user.verification_key = fake.md5()
     self.user.save()
     mock_response = make_external_response()
     validated_creds = cas.validate_external_credential(mock_response.user)
     self.user.external_identity = {validated_creds["provider"]: {validated_creds["id"]: "VERIFIED"}}
     self.user.save()
     mock_service_validate.return_value = mock_response
     ticket = fake.md5()
     service_url = "http://accounts.osf.io/?ticket=" + ticket
     resp = cas.make_response_from_ticket(ticket, service_url)
开发者ID:cslzchen,项目名称:osf.io,代码行数:11,代码来源:test_cas_authentication.py


示例4: make_successful_response

def make_successful_response(user):
    return cas.CasResponse(
        authenticated=True, user=user._primary_key,
        attributes={
            'accessToken': fake.md5()
        }
    )
开发者ID:AllisonLBowers,项目名称:osf.io,代码行数:7,代码来源:test_cas_authentication.py


示例5: test_make_response_from_ticket_failure

 def test_make_response_from_ticket_failure(self, mock_service_validate):
     mock_response = make_failure_response()
     mock_service_validate.return_value = mock_response
     ticket = fake.md5()
     service_url = 'http://accounts.osf.io/?ticket=' + ticket
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302)
     assert_equal(resp.location, 'http://accounts.osf.io/')
开发者ID:AllisonLBowers,项目名称:osf.io,代码行数:8,代码来源:test_cas_authentication.py


示例6: test_make_response_from_ticket_generates_new_verification_key

 def test_make_response_from_ticket_generates_new_verification_key(self, mock_service_validate):
     self.user.verification_key = fake.md5()
     self.user.save()
     mock_response = make_external_response()
     validated_creds = cas.validate_external_credential(mock_response.user)
     self.user.external_identity = {
         validated_creds['provider']: {
             validated_creds['id']: 'VERIFIED'
         }
     }
     self.user.save()
     mock_service_validate.return_value = mock_response
     ticket = fake.md5()
     service_url = 'http://localhost:5000/'
     verification_key = self.user.verification_key
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_not_equal(self.user.verification_key, verification_key)
开发者ID:baylee-d,项目名称:osf.io,代码行数:17,代码来源:test_cas_authentication.py


示例7: test_make_response_from_ticket_no_user

 def test_make_response_from_ticket_no_user(self, mock_service_validate):
     mock_response = make_external_response()
     mock_service_validate.return_value = mock_response
     ticket = fake.md5()
     service_url = "http://accounts.osf.io/?ticket=" + ticket
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302)
     assert_equal(resp.location, "/external-login/email")
开发者ID:cslzchen,项目名称:osf.io,代码行数:8,代码来源:test_cas_authentication.py


示例8: test_successful_external_first_login_without_attributes

 def test_successful_external_first_login_without_attributes(self, mock_service_validate, mock_get_user_from_cas_resp, mock_external_first_login_authenticate):
     service_url = 'http://localhost:5000/dashboard/'
     user, validated_credentials, cas_resp = generate_external_user_with_resp(service_url, user=False, release=False)
     mock_service_validate.return_value = cas_resp
     mock_get_user_from_cas_resp.return_value = (None, validated_credentials, 'external_first_login')
     ticket = fake.md5()
     cas.make_response_from_ticket(ticket, service_url)
     assert_equal(user, mock_external_first_login_authenticate.call_args[0][0])
开发者ID:CenterForOpenScience,项目名称:osf.io,代码行数:8,代码来源:test_auth.py


示例9: test_parse_authorization_header

def test_parse_authorization_header():
    token = fake.md5()
    valid = 'Bearer {}'.format(token)
    assert_equal(cas.parse_auth_header(valid), token)

    missing_token = 'Bearer '
    with assert_raises(cas.CasTokenError):
        cas.parse_auth_header(missing_token)
开发者ID:AllisonLBowers,项目名称:osf.io,代码行数:8,代码来源:test_cas_authentication.py


示例10: test_make_response_from_ticket_success

 def test_make_response_from_ticket_success(self, mock_service_validate, mock_get_user_from_cas_resp):
     mock_service_validate.return_value = make_successful_response(self.user)
     mock_get_user_from_cas_resp.return_value = (self.user, None, 'authenticate')
     ticket = fake.md5()
     service_url = 'http://localhost:5000/'
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302)
     assert_equal(mock_service_validate.call_count, 1)
     assert_equal(mock_get_user_from_cas_resp.call_count, 1)
开发者ID:CenterForOpenScience,项目名称:osf.io,代码行数:9,代码来源:test_cas_authentication.py


示例11: make_service_validation_response_body

def make_service_validation_response_body(user, access_token=None):
    token = access_token or fake.md5()
    return RESPONSE_TEMPLATE.format(
        user_id=user._primary_key,
        given_name=user.given_name,
        family_name=user.family_name,
        username=user.username,
        access_token=token
    )
开发者ID:AllisonLBowers,项目名称:osf.io,代码行数:9,代码来源:test_cas_authentication.py


示例12: test_make_response_from_ticket_failure

 def test_make_response_from_ticket_failure(self, mock_service_validate, mock_get_user_from_cas_resp):
     mock_service_validate.return_value = make_failure_response()
     mock_get_user_from_cas_resp.return_value = (None, None, None)
     ticket = fake.md5()
     service_url = 'http://localhost:5000/'
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302)
     assert_equal(mock_service_validate.call_count, 1)
     assert_equal(mock_get_user_from_cas_resp.call_count, 0)
开发者ID:CenterForOpenScience,项目名称:osf.io,代码行数:9,代码来源:test_cas_authentication.py


示例13: test_successful_external_first_login

 def test_successful_external_first_login(self, mock_service_validate, mock_get_user_from_cas_resp):
     service_url = 'http://localhost:5000/dashboard/'
     _, validated_credentials, cas_resp = generate_external_user_with_resp(service_url, user=False)
     mock_service_validate.return_value = cas_resp
     mock_get_user_from_cas_resp.return_value = (None, validated_credentials, 'external_first_login')
     ticket = fake.md5()
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302, 'redirect to external login email get')
     assert_in('/external-login/email', resp.location)
开发者ID:CenterForOpenScience,项目名称:osf.io,代码行数:9,代码来源:test_auth.py


示例14: make_external_response

def make_external_response():
    return cas.CasResponse(
        authenticated=True,
        user='OrcidProfile#{}'.format(fake.numerify('####-####-####-####')),
        attributes={
            'given-names': fake.first_name(),
            'family-name': fake.last_name(),
            'accessToken': fake.md5(),
        }
    )
开发者ID:monikagrabowska,项目名称:osf.io,代码行数:10,代码来源:test_cas_authentication.py


示例15: test_service_validate

 def test_service_validate(self):
     user = UserFactory()
     url = furl.furl(self.base_url)
     url.path.segments.extend(("p3", "serviceValidate"))
     service_url = "http://test.osf.io"
     ticket = fake.md5()
     body = make_service_validation_response_body(user, ticket)
     httpretty.register_uri(httpretty.GET, url.url, body=body, status=200)
     resp = self.client.service_validate(ticket, service_url)
     assert_true(resp.authenticated)
开发者ID:cslzchen,项目名称:osf.io,代码行数:10,代码来源:test_cas_authentication.py


示例16: test_make_response_from_ticket_handles_non_unicode

 def test_make_response_from_ticket_handles_non_unicode(self, mock_service_validate):
     mock_response = make_external_response()
     mock_service_validate.return_value = mock_response
     ticket = fake.md5()
     service_url = "http://accounts.osf.io/?ticket=" + ticket
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302)
     assert_equal(mock_service_validate.call_count, 1)
     first_call_args = mock_service_validate.call_args[0]
     assert_equal(first_call_args[0], ticket)
     assert_equal(first_call_args[1], "http://accounts.osf.io/")
开发者ID:cslzchen,项目名称:osf.io,代码行数:11,代码来源:test_cas_authentication.py


示例17: test_make_response_from_ticket_success

 def test_make_response_from_ticket_success(self, mock_service_validate):
     mock_response = make_successful_response(self.user)
     mock_service_validate.return_value = mock_response
     ticket = fake.md5()
     service_url = 'http://accounts.osf.io/?ticket=' + ticket
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302)
     mock_service_validate.assert_called_once()
     first_call_args = mock_service_validate.call_args[0]
     assert_equal(first_call_args[0], ticket)
     assert_equal(first_call_args[1], 'http://accounts.osf.io/')
开发者ID:AllisonLBowers,项目名称:osf.io,代码行数:11,代码来源:test_cas_authentication.py


示例18: test_successful_external_login_cas_redirect

 def test_successful_external_login_cas_redirect(self, mock_service_validate, mock_get_user_from_cas_resp):
     user, validated_credentials, cas_resp = generate_external_user_with_resp()
     mock_service_validate.return_value = cas_resp
     mock_get_user_from_cas_resp.return_value = (user, validated_credentials, 'authenticate')
     ticket = fake.md5()
     service_url = 'http://accounts.osf.io/?ticket=' + ticket
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302, 'redirect to CAS login')
     assert_in('/login?service=', resp.location)
     assert_in('username={}'.format(user.username), resp.location)
     assert_in('verification_key={}'.format(user.verification_key), resp.location)
开发者ID:cslzchen,项目名称:osf.io,代码行数:11,代码来源:test_auth.py


示例19: test_make_response_from_ticket_handles_unicode

 def test_make_response_from_ticket_handles_unicode(self, mock_service_validate):
     mock_response = make_external_response(unicode=True)
     mock_service_validate.return_value = mock_response
     ticket = fake.md5()
     service_url = 'http://localhost:5000/'
     resp = cas.make_response_from_ticket(ticket, service_url)
     assert_equal(resp.status_code, 302)
     assert_equal(mock_service_validate.call_count, 1)
     first_call_args = mock_service_validate.call_args[0]
     assert_equal(first_call_args[0], ticket)
     assert_equal(first_call_args[1], 'http://localhost:5000/')
开发者ID:CenterForOpenScience,项目名称:osf.io,代码行数:11,代码来源:test_cas_authentication.py


示例20: make_external_response

def make_external_response(release=True, unicode=False):
    attributes = {"accessToken": fake.md5()}
    if release:
        attributes.update(
            {
                "given-names": fake.first_name() if not unicode else u"нет",
                "family-name": fake.last_name() if not unicode else u"Да",
            }
        )
    return cas.CasResponse(
        authenticated=True, user="OrcidProfile#{}".format(fake.numerify("####-####-####-####")), attributes=attributes
    )
开发者ID:cslzchen,项目名称:osf.io,代码行数:12,代码来源:test_cas_authentication.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python fake.name函数代码示例发布时间:2022-05-27
下一篇:
Python fake.email函数代码示例发布时间: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