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


Python fake.md5函数代码示例

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


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


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