예제 #1
0
    def test_commands(self):
        for distro_name in cc_ca_certs.distros:
            conf = cc_ca_certs._distro_ca_certs_configs(distro_name)

            with ExitStack() as mocks:
                mock_delete = mocks.enter_context(
                    mock.patch.object(util, 'delete_dir_contents'))
                mock_write = mocks.enter_context(
                    mock.patch.object(util, 'write_file'))
                mock_subp = mocks.enter_context(mock.patch.object(
                    subp, 'subp'))

                cc_ca_certs.remove_default_ca_certs(distro_name, conf)

                mock_delete.assert_has_calls([
                    mock.call(conf['ca_cert_path']),
                    mock.call(conf['ca_cert_system_path'])
                ])

                if conf['ca_cert_config'] is not None:
                    mock_write.assert_called_once_with(conf['ca_cert_config'],
                                                       "",
                                                       mode=0o644)

                if distro_name in ['debian', 'ubuntu']:
                    mock_subp.assert_called_once_with(
                        ('debconf-set-selections', '-'), "ca-certificates \
ca-certificates/trust_new_crts select no")
예제 #2
0
    def test_commands(self):
        for distro_name in cc_ca_certs.distros:
            conf = cc_ca_certs._distro_ca_certs_configs(distro_name)

            with ExitStack() as mocks:
                mock_delete = mocks.enter_context(
                    mock.patch.object(util, "delete_dir_contents")
                )
                mock_write = mocks.enter_context(
                    mock.patch.object(util, "write_file")
                )
                mock_subp = mocks.enter_context(
                    mock.patch.object(subp, "subp")
                )

                cc_ca_certs.remove_default_ca_certs(distro_name, conf)

                mock_delete.assert_has_calls(
                    [
                        mock.call(conf["ca_cert_path"]),
                        mock.call(conf["ca_cert_system_path"]),
                    ]
                )

                if conf["ca_cert_config"] is not None:
                    mock_write.assert_called_once_with(
                        conf["ca_cert_config"], "", mode=0o644
                    )

                if distro_name in ["debian", "ubuntu"]:
                    mock_subp.assert_called_once_with(
                        ("debconf-set-selections", "-"),
                        "ca-certificates ca-certificates/trust_new_crts"
                        " select no",
                    )
    def test_commands(self):
        mock_delete_dir_contents = self.mocker.replace(
            util.delete_dir_contents, passthrough=False)
        mock_write = self.mocker.replace(util.write_file, passthrough=False)
        mock_subp = self.mocker.replace(util.subp, passthrough=False)

        mock_delete_dir_contents("/usr/share/ca-certificates/")
        mock_delete_dir_contents("/etc/ssl/certs/")
        mock_write("/etc/ca-certificates.conf", "", mode=0644)
        mock_subp(('debconf-set-selections', '-'),
                  "ca-certificates ca-certificates/trust_new_crts select no")
        self.mocker.replay()

        cc_ca_certs.remove_default_ca_certs()
    def test_commands(self):
        mock_delete_dir_contents = self.mocker.replace(
            util.delete_dir_contents, passthrough=False)
        mock_write = self.mocker.replace(util.write_file, passthrough=False)
        mock_subp = self.mocker.replace(util.subp,
                                        passthrough=False)

        mock_delete_dir_contents("/usr/share/ca-certificates/")
        mock_delete_dir_contents("/etc/ssl/certs/")
        mock_write("/etc/ca-certificates.conf", "", mode=0644)
        mock_subp(('debconf-set-selections', '-'),
                  "ca-certificates ca-certificates/trust_new_crts select no")
        self.mocker.replay()

        cc_ca_certs.remove_default_ca_certs()
예제 #5
0
    def test_commands(self):
        with ExitStack() as mocks:
            mock_delete = mocks.enter_context(
                mock.patch.object(util, 'delete_dir_contents'))
            mock_write = mocks.enter_context(
                mock.patch.object(util, 'write_file'))
            mock_subp = mocks.enter_context(mock.patch.object(subp, 'subp'))

            cc_ca_certs.remove_default_ca_certs()

            mock_delete.assert_has_calls([
                mock.call("/usr/share/ca-certificates/"),
                mock.call("/etc/ssl/certs/")])

            mock_write.assert_called_once_with(
                "/etc/ca-certificates.conf", "", mode=0o644)

            mock_subp.assert_called_once_with(
                ('debconf-set-selections', '-'),
                "ca-certificates ca-certificates/trust_new_crts select no")
    def test_commands(self):
        with ExitStack() as mocks:
            mock_delete = mocks.enter_context(
                mock.patch.object(util, 'delete_dir_contents'))
            mock_write = mocks.enter_context(
                mock.patch.object(util, 'write_file'))
            mock_subp = mocks.enter_context(mock.patch.object(util, 'subp'))

            cc_ca_certs.remove_default_ca_certs()

            mock_delete.assert_has_calls([
                mock.call("/usr/share/ca-certificates/"),
                mock.call("/etc/ssl/certs/")])

            mock_write.assert_called_once_with(
                "/etc/ca-certificates.conf", "", mode=0o644)

            mock_subp.assert_called_once_with(
                ('debconf-set-selections', '-'),
                "ca-certificates ca-certificates/trust_new_crts select no")