Skip to content

Commit

Permalink
unit test has_invalid_config
Browse files Browse the repository at this point in the history
  • Loading branch information
kwmonroe committed Mar 11, 2024
1 parent b59baa6 commit 8d9b2e5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/unit/test_docker_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,18 @@ def test_configure_registry(config, mock_kv, mock_write, mock_host, mock_lc):
layer.docker_registry.configure_registry()
args, _ = mock_yaml.safe_dump.call_args_list[0]
assert expected["storage"].items() <= args[0]["storage"].items()


@mock.patch("charmhelpers.core.hookenv.config")
def test_has_invalid_config(config):
# check valid config is valid
config.return_value = {
"storage-cache": "disabled",
}
assert not layer.docker_registry.has_invalid_config()

# check for bad apples
config.return_value = {
"storage-cache": "bananas",
}
assert "storage-cache" in layer.docker_registry.has_invalid_config()

0 comments on commit 8d9b2e5

Please sign in to comment.