Skip to content

Commit 770c6e7

Browse files
sambacc: add an initial_data argument to GlobalConfig class
Add a new keyword-only initial_data argument to GlobalConfig. This is primarily for testing so that we can load data directly into the global configuration object without going through all validations that real json read from a file does. Signed-off-by: John Mulligan <[email protected]>
1 parent 0b04032 commit 770c6e7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sambacc/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ def shares(self) -> typing.Iterable[ShareConfig]:
9595

9696

9797
class GlobalConfig:
98-
def __init__(self, source: typing.Optional[typing.IO] = None) -> None:
99-
self.data: JSONData = {}
98+
def __init__(
99+
self,
100+
source: typing.Optional[typing.IO] = None,
101+
*,
102+
initial_data: typing.Optional[JSONData] = None,
103+
) -> None:
104+
self.data: JSONData = {} if initial_data is None else initial_data
100105
if source is not None:
101106
self.load(source)
102107

0 commit comments

Comments
 (0)