mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 00:35:50 +02:00
Adding tests
This commit is contained in:
@@ -66,7 +66,6 @@ class AuthHandler(object):
|
||||
|
||||
self._choose_challenges(domains)
|
||||
|
||||
|
||||
# While there are still challenges remaining...
|
||||
while self.achalls:
|
||||
resp = self._solve_challenges()
|
||||
@@ -80,11 +79,11 @@ class AuthHandler(object):
|
||||
|
||||
# Only return valid authorizations
|
||||
retVal = [authzr for authzr in self.authzr.values()
|
||||
if authzr.body.status == messages.STATUS_VALID]
|
||||
if authzr.body.status == messages.STATUS_VALID]
|
||||
|
||||
if len(retVal) <= 0:
|
||||
logger.critical("Challenges failed for all domains")
|
||||
raise
|
||||
raise errors.AuthorizationError(
|
||||
"Challenges failed for all domains")
|
||||
|
||||
return retVal
|
||||
|
||||
|
||||
@@ -1244,6 +1244,9 @@ class HelpfulArgumentParser(object):
|
||||
parsed_args.register_unsafely_without_email = True
|
||||
|
||||
if parsed_args.csr:
|
||||
if parsed_args.allow_subset_of_names:
|
||||
raise errors.Error("--allow-subset-of-names "
|
||||
"cannot be used with --csr")
|
||||
self.handle_csr(parsed_args)
|
||||
|
||||
if self.detect_defaults: # plumbing
|
||||
|
||||
@@ -163,6 +163,9 @@ class GetAuthorizationsTest(unittest.TestCase):
|
||||
self.assertRaises(
|
||||
errors.AuthorizationError, self.handler.get_authorizations, ["0"])
|
||||
|
||||
def test_no_domains(self):
|
||||
self.assertRaises(errors.AuthorizationError, self.handler.get_authorizations, [])
|
||||
|
||||
def _validate_all(self, unused_1, unused_2):
|
||||
for dom in self.handler.authzr.keys():
|
||||
azr = self.handler.authzr[dom]
|
||||
|
||||
@@ -360,6 +360,10 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
||||
self._call,
|
||||
['-d', '204.11.231.35'])
|
||||
|
||||
def test_csr_with_besteffort(self):
|
||||
args = ["--csr", CSR, "--allow-subset-of-names"]
|
||||
self.assertRaises(errors.Error, self._call, args)
|
||||
|
||||
def test_run_with_csr(self):
|
||||
# This is an error because you can only use --csr with certonly
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user