Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use ConfigParser and not SafeConfigParser #405

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/complex/fake_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def __init__(self, queue, port=None, code=None, host='localhost'):
raise OSError("No such file %s" % certfile)
if not os.access(keyfile, os.R_OK):
raise OSError("No such file %s" % keyfile)
self.server.socket = ssl.wrap_socket(self.server.socket, certfile=certfile, keyfile=keyfile, server_side=True)
ssl_ctx = ssl.create_default_context()
ssl_ctx.load_cert_chain(certfile=certfile, keyfile=keyfile)
ssl_ctx.check_hostname = False
self.server.socket = ssl_ctx.wrap_socket(self.server.socket, server_side=True)

self.tempdir = tempfile.mkdtemp()
config_name = os.path.join(self.tempdir, 'rhsm.conf')
Expand Down
2 changes: 2 additions & 0 deletions tests/complex/test_esx_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
import os
import tempfile
import shutil
import pytest

import virtwhotest

from fake_esx import FakeEsx


@pytest.mark.skip(reason="This is not unit test. It is integration test. We should not do it here.")
class EsxTest(virtwhotest.TestBase):
"""
Class for complex testing of obtaining host-to-guest mapping from fake ESX server
Expand Down
2 changes: 1 addition & 1 deletion tests/test_satellite.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

from base import TestBase

from virtwho.config import DestinationToSourceMapper, EffectiveConfig, ConfigSection,\
from virtwho.config import DestinationToSourceMapper, EffectiveConfig, ConfigSection, \
parse_file, Satellite5DestinationInfo, VirtConfigSection
from virtwho.manager import Manager
from virtwho.manager.satellite import Satellite, SatelliteError
Expand Down
8 changes: 4 additions & 4 deletions virtwho/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import uuid
import requests

from configparser import SafeConfigParser
from configparser import ConfigParser
from configparser import DuplicateOptionError, NoOptionError, Error, MissingSectionHeaderError

from virtwho import log, SAT5, SAT6
Expand Down Expand Up @@ -236,10 +236,10 @@ class DefaultDestinationInfo(Info):
default_destination_info.name = "default_destination"


class StripQuotesConfigParser(SafeConfigParser):
class StripQuotesConfigParser(ConfigParser):
def get(self, section, option, **kwargs):
# Don't call super, SafeConfigParser is not inherited from object
value = SafeConfigParser.get(self, section, option, **kwargs)
# Don't call super, ConfigParser is not inherited from object
value = ConfigParser.get(self, section, option, **kwargs)
for quote in ('"', "'"):
# Strip the quotes only when the value starts with quote,
# ends with quote but doesn't contain it inside
Expand Down