def setUp(self): from certbot.errors import FailedChallenges self.error = FailedChallenges({ achallenges.DNS(domain="example.com", challb=messages.ChallengeBody( chall=acme_util.DNS01, uri=None, error=messages.Error.with_code( "tls", detail="detail"))) })
def setUp(self): from certbot.errors import FailedChallenges self.error = FailedChallenges( set([ achallenges.DNS(domain="example.com", challb=messages.ChallengeBody( chall=acme_util.DNS, uri=None, error=messages.Error(typ="tls", detail="detail"))) ]))
def test_unicode(self): from certbot.errors import FailedChallenges arabic_detail = u'\u0639\u062f\u0627\u0644\u0629' arabic_error = FailedChallenges({achallenges.DNS( domain="example.com", challb=messages.ChallengeBody( chall=acme_util.DNS01, uri=None, error=messages.Error.with_code("tls", detail=arabic_detail)))}) self.assertTrue(str(arabic_error).startswith( "Failed authorization procedure. example.com (dns-01): " "urn:ietf:params:acme:error:tls"))
def challb_to_achall(challb: messages.ChallengeBody, account_key: josepy.JWK, domain: str) -> achallenges.AnnotatedChallenge: """Converts a ChallengeBody object to an AnnotatedChallenge. :param .ChallengeBody challb: ChallengeBody :param .JWK account_key: Authorized Account Key :param str domain: Domain of the challb :returns: Appropriate AnnotatedChallenge :rtype: :class:`certbot.achallenges.AnnotatedChallenge` """ chall = challb.chall logger.info("%s challenge for %s", chall.typ, domain) if isinstance(chall, challenges.KeyAuthorizationChallenge): return achallenges.KeyAuthorizationAnnotatedChallenge( challb=challb, domain=domain, account_key=account_key) elif isinstance(chall, challenges.DNS): return achallenges.DNS(challb=challb, domain=domain) raise errors.Error(f"Received unsupported challenge of type: {chall.typ}")