diff --git a/src-docs/charm_state.py.md b/src-docs/charm_state.py.md
index 143d353..9fb524a 100644
--- a/src-docs/charm_state.py.md
+++ b/src-docs/charm_state.py.md
@@ -5,9 +5,6 @@
# module `charm_state.py`
Module defining the CharmState class which represents the state of the SMTP Integrator charm.
-**Global Variables**
----------------
-- **KNOWN_CHARM_CONFIG**
---
@@ -21,7 +18,7 @@ Exception raised when a charm configuration is found to be invalid.
- `msg` (str): Explanation of the error.
-
+
### function `__init__`
@@ -59,7 +56,7 @@ Represents the state of the SMTP Integrator charm.
- `transport_security`: The security protocol to use for the outgoing SMTP relay.
- `domain`: The domain used by the sent emails from SMTP relay.
-
+
### function `__init__`
@@ -80,7 +77,7 @@ Initialize a new instance of the CharmState class.
---
-
+
### classmethod `from_charm`
diff --git a/src/charm_state.py b/src/charm_state.py
index 593626d..63c2872 100644
--- a/src/charm_state.py
+++ b/src/charm_state.py
@@ -13,16 +13,6 @@
from charms.smtp_integrator.v0 import smtp
from pydantic import BaseModel, Field, ValidationError
-KNOWN_CHARM_CONFIG = (
- "host",
- "port",
- "user",
- "password",
- "auth_type",
- "transport_security",
- "domain",
-)
-
class SmtpIntegratorConfig(BaseModel):
"""Represent charm builtin configuration values.
@@ -114,10 +104,9 @@ def from_charm(cls, charm: "ops.CharmBase") -> "CharmState":
Raises:
CharmConfigInvalidError: if the charm configuration is invalid.
"""
- config = {k: v for k, v in charm.config.items() if k in KNOWN_CHARM_CONFIG}
try:
# Incompatible with pydantic.AnyHttpUrl
- valid_config = SmtpIntegratorConfig(**config) # type: ignore
+ valid_config = SmtpIntegratorConfig(**dict(charm.config.items())) # type: ignore
except ValidationError as exc:
error_fields = set(
itertools.chain.from_iterable(error["loc"] for error in exc.errors())
diff --git a/tests/unit/test_charm_state.py b/tests/unit/test_charm_state.py
index 4c972d2..ef4ddd8 100644
--- a/tests/unit/test_charm_state.py
+++ b/tests/unit/test_charm_state.py
@@ -6,20 +6,8 @@
from unittest.mock import MagicMock
import pytest
-import yaml
-from charm_state import KNOWN_CHARM_CONFIG, CharmConfigInvalidError, CharmState
-
-
-def test_known_charm_config():
- """
- arrange: none
- act: none
- assert: KNOWN_CHARM_CONFIG in the consts module matches the content of config.yaml file.
- """
- with open("config.yaml", encoding="utf-8") as config_file:
- config = yaml.safe_load(config_file)
- assert sorted(config["options"].keys()) == sorted(KNOWN_CHARM_CONFIG)
+from charm_state import CharmConfigInvalidError, CharmState
def test_charm_state_from_charm():