Adding tests

This commit is contained in:
Amjad Mashaal
2016-03-21 01:12:59 +02:00
parent 4d6a1ee7ff
commit 6f25005559
4 changed files with 13 additions and 4 deletions
+3 -4
View File
@@ -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
+3
View File
@@ -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
+3
View File
@@ -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]
+4
View File
@@ -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: