Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusbv committed Apr 23, 2024
1 parent a994cc4 commit 1046b56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/cloudregister/registerutils.py
Expand Up @@ -1780,7 +1780,7 @@ def _set_registry_order_search_docker():
docker_cfg_json = _get_registry_conf_file(DOCKER_CONFIG_PATH, 'docker')
secure_urls += docker_cfg_json.get('secure-registries', [])
mirrors_urls += docker_cfg_json.get('registry-mirrors', [])
except (FileNotFoundError): # , KeyError):
except (FileNotFoundError):
# config file does not exist,
os.makedirs(os.path.dirname(DOCKER_CONFIG_PATH), exist_ok=True)

Expand Down
11 changes: 8 additions & 3 deletions tests/test_registerutils.py
Expand Up @@ -3168,6 +3168,7 @@ def test_set_registry_order_search_podman_no_configured(
mock_get_registry_file.side_effect = [FileNotFoundError(), registry_conf]
with patch('builtins.open', create=True) as mock_open:
mock_open_podman_config = MagicMock(spec=io.IOBase)

def open_file(filename, mode):
return mock_open_podman_config.return_value

Expand Down Expand Up @@ -3206,6 +3207,7 @@ def test_set_registry_order_search_podman_conf_missing_suse_registry(
mock_get_registry_file.return_value = registry_conf
with patch('builtins.open', create=True) as mock_open:
mock_open_podman_config = MagicMock(spec=io.IOBase)

def open_file(filename, mode):
return mock_open_podman_config.return_value

Expand Down Expand Up @@ -3269,8 +3271,9 @@ def open_file(filename, mode):
def test_set_registry_order_search_docker_not_key_secure(
mock_json_dump, mock_get_registry_conf_file
):
with patch('builtins.open', create=True) as mock_open:
with patch('builtins.open', create=True) as mock_open:
mock_open_podman_config = MagicMock(spec=io.IOBase)

def open_file(filename, mode):
return mock_open_podman_config.return_value

Expand All @@ -3297,8 +3300,9 @@ def open_file(filename, mode):
def test_set_registry_order_search_docker_not_key_mirror(
mock_json_dump, mock_get_registry_conf_file
):
with patch('builtins.open', create=True) as mock_open:
with patch('builtins.open', create=True) as mock_open:
mock_open_podman_config = MagicMock(spec=io.IOBase)

def open_file(filename, mode):
return mock_open_podman_config.return_value

Expand Down Expand Up @@ -3327,8 +3331,9 @@ def test_set_registry_order_search_docker_not_file(
mock_json_dump, mock_get_registry_conf_file,
mock_os_makedirs
):
with patch('builtins.open', create=True) as mock_open:
with patch('builtins.open', create=True) as mock_open:
mock_open_podman_config = MagicMock(spec=io.IOBase)

def open_file(filename, mode):
return mock_open_podman_config.return_value

Expand Down

0 comments on commit 1046b56

Please sign in to comment.