Exemple #1
0
 def _cli_missing_flag(self, args, message):
     "Ensure that a particular error raises a missing cli flag error containing message"
     exc = None
     try:
         with mock.patch('letsencrypt.main.sys.stderr'):
             main.main(self.standard_args + args[:])  # NOTE: parser can alter its args!
     except errors.MissingCommandlineFlag as exc:
         self.assertTrue(message in str(exc))
     self.assertTrue(exc is not None)
Exemple #2
0
 def _cli_missing_flag(self, args, message):
     "Ensure that a particular error raises a missing cli flag error containing message"
     exc = None
     try:
         with mock.patch('letsencrypt.main.sys.stderr'):
             main.main(self.standard_args +
                       args[:])  # NOTE: parser can alter its args!
     except errors.MissingCommandlineFlag as exc:
         self.assertTrue(message in str(exc))
     self.assertTrue(exc is not None)
Exemple #3
0
 def _call_no_clientmock(self, args):
     "Run the client with output streams mocked out"
     args = self.standard_args + args
     with mock.patch('letsencrypt.main.sys.stdout') as stdout:
         with mock.patch('letsencrypt.main.sys.stderr') as stderr:
             ret = main.main(args[:])  # NOTE: parser can alter its args!
     return ret, stdout, stderr
Exemple #4
0
 def _call_no_clientmock(self, args):
     "Run the client with output streams mocked out"
     args = self.standard_args + args
     with mock.patch('letsencrypt.main.sys.stdout') as stdout:
         with mock.patch('letsencrypt.main.sys.stderr') as stderr:
             ret = main.main(args[:])  # NOTE: parser can alter its args!
     return ret, stdout, stderr
Exemple #5
0
    def _call_no_clientmock(self, args, stdout=None):
        "Run the client with output streams mocked out"
        args = self.standard_args + args

        toy_stdout = stdout if stdout else six.StringIO()
        with mock.patch('letsencrypt.main.sys.stdout', new=toy_stdout):
            with mock.patch('letsencrypt.main.sys.stderr') as stderr:
                ret = main.main(args[:])  # NOTE: parser can alter its args!
        return ret, toy_stdout, stderr
Exemple #6
0
    def _call_no_clientmock(self, args, stdout=None):
        "Run the client with output streams mocked out"
        args = self.standard_args + args

        toy_stdout = stdout if stdout else six.StringIO()
        with mock.patch('letsencrypt.main.sys.stdout', new=toy_stdout):
            with mock.patch('letsencrypt.main.sys.stderr') as stderr:
                ret = main.main(args[:])  # NOTE: parser can alter its args!
        return ret, toy_stdout, stderr
Exemple #7
0
 def _call_stdout(self, args):
     """
     Variant of _call that preserves stdout so that it can be mocked by the
     caller.
     """
     args = self.standard_args + args
     with mock.patch('letsencrypt.main.sys.stderr') as stderr:
         with mock.patch('letsencrypt.main.client') as client:
             ret = main.main(args[:])  # NOTE: parser can alter its args!
     return ret, None, stderr, client
Exemple #8
0
 def _call_stdout(self, args):
     """
     Variant of _call that preserves stdout so that it can be mocked by the
     caller.
     """
     args = self.standard_args + args
     with mock.patch('letsencrypt.main.sys.stderr') as stderr:
         with mock.patch('letsencrypt.main.client') as client:
             ret = main.main(args[:])  # NOTE: parser can alter its args!
     return ret, None, stderr, client
Exemple #9
0
# Start a thread with the server
server_thread = threading.Thread(target=httpd.serve_forever)

# Exit the server thread when the main thread terminates
server_thread.daemon = True
server_thread.start()
print("Server loop listening on port ", port, ". Running in thread: ",
      server_thread.name)

print("Starting Let's Encrypt process in 1 minute...")

time.sleep(60)

print("Calling letsencrypt...")

cli.main(args)

print("Done.")
print("Fetch the certs and logs via cf files ...")
print("You can get them with these commands: ")

host = settings['domains'][0]['hosts'][0]
domain = settings['domains'][0]['domain']
path = host + "." + domain

if host == '.':
    path = domain

print("cf files letsencrypt app/conf/live/" + path + "/cert.pem")
print("cf files letsencrypt app/conf/live/" + path + "/chain.pem")
print("cf files letsencrypt app/conf/live/" + path + "/fullchain.pem")
Exemple #10
0
# Start a thread with the server
server_thread = threading.Thread(target=httpd.serve_forever)

# Exit the server thread when the main thread terminates
server_thread.daemon = True
server_thread.start()
print("Server loop listening on port ", port, ". Running in thread: ", server_thread.name)

print("Starting Let's Encrypt process in 1 minute...")

time.sleep(60)

print("Calling letsencrypt...")

cli.main(args)

print("Done.")
print("Fetch the certs and logs via cf files ...")
print("You can get them with these commands: ")

host = settings['domains'][0]['hosts'][0]
domain = settings['domains'][0]['domain']
path = host + "." + domain

if host == '.':
    path = domain

print("cf files letsencrypt app/conf/live/" + path + "/cert.pem")
print("cf files letsencrypt app/conf/live/" + path + "/chain.pem")
print("cf files letsencrypt app/conf/live/" + path + "/fullchain.pem")