Exemplo n.º 1
0
 def setUp(self):
     super().setUp()
     self.config.rsa_key_size = 1024
     self.config.register_unsafely_without_email = False
     self.config.email = "*****@*****.**"
     self.account_storage = account.AccountMemoryStorage()
     with mock.patch("zope.component.provideUtility"):
         display_obj.set_display(MagicMock())
Exemplo n.º 2
0
    def setUp(self):
        display_obj.set_display(display_obj.FileDisplay(sys.stdout, False))

        self.mock_apache = mock.Mock(
            description_with_name="a", misconfigured=True)
        self.mock_apache.name = "apache"
        self.mock_stand = mock.Mock(
            description_with_name="s", misconfigured=False)
        self.mock_stand.init().more_info.return_value = "standalone"
        self.plugins = [
            self.mock_apache,
            self.mock_stand,
        ]
Exemplo n.º 3
0
    def setUp(self):
        super().setUp()

        display_obj.set_display(display_obj.FileDisplay(sys.stdout, False))

        self.account_keys_dir = os.path.join(self.tempdir, "keys")
        filesystem.makedirs(self.account_keys_dir, 0o700)

        self.config = mock.MagicMock(
            accounts_dir=self.tempdir,
            account_keys_dir=self.account_keys_dir,
            server="certbot-demo.org")
        self.key = KEY

        self.acc1 = account.Account(messages.RegistrationResource(
            uri=None, body=messages.Registration.from_data(
                email="*****@*****.**")), self.key)
        self.acc2 = account.Account(messages.RegistrationResource(
            uri=None, body=messages.Registration.from_data(
                email="*****@*****.**", phone="phone")), self.key)
Exemplo n.º 4
0
def main(args):
    ## Prepare storage system
    command = args.command.lower()
    log.pre_arg_parse_setup()
    cli_args = prepare_cli_args(args)
    config, _ = prepare_config(cli_args)
    misc.raise_for_non_administrative_windows_rights()

    try:
        log.post_arg_parse_setup(config)
        certbot_main.make_or_verify_needed_dirs(config)
    except errors.Error:
        raise
    report = reporter.Reporter(config)
    zope.component.provideUtility(report, interfaces.IReporter)
    util.atexit_register(report.print_messages)
    with certbot_main.make_displayer(config) as displayer:
        display_obj.set_display(displayer)

    if (command == 'cert'):
        request_cert(args, config)
    elif (command == 'revoke'):
        revoke_cert(args, config)
Exemplo n.º 5
0
    def setUp(self):
        from certbot._internal.auth_handler import AuthHandler

        self.mock_display = mock.Mock()
        self.mock_config = mock.Mock(debug_challenges=False)
        with mock.patch("zope.component.provideUtility"):
            display_obj.set_display(self.mock_display)

        self.mock_auth = mock.MagicMock(name="Authenticator")

        self.mock_auth.get_chall_pref.return_value = [challenges.HTTP01]

        self.mock_auth.perform.side_effect = gen_auth_resp

        self.mock_account = mock.MagicMock()
        self.mock_net = mock.MagicMock(spec=acme_client.ClientV2)
        self.mock_net.acme_version = 1
        self.mock_net.retry_after.side_effect = acme_client.ClientV2.retry_after

        self.handler = AuthHandler(self.mock_auth, self.mock_net,
                                   self.mock_account, [])

        logging.disable(logging.CRITICAL)
Exemplo n.º 6
0
def setup_display():
    """"Prepares a display utility instance for the Certbot plugins """
    displayer = display_util.NoninteractiveDisplay(sys.stdout)
    display_obj.set_display(displayer)
Exemplo n.º 7
0
 def setUp(self):
     display_obj.set_display(display_obj.FileDisplay(sys.stdout, False))
     self.mock_install = mock.MagicMock()
Exemplo n.º 8
0
 def setUp(self):
     display_obj.set_display(display_obj.FileDisplay(sys.stdout, False))