Skip to content

Commit 00fc945

Browse files
tests: supply invalid configuration to GloalConfig directly
Update a test to use the new initial_data argument of GlobalConfig. Since this test is checking run time behavior of invalid data it is best to bypass any other checks that GlobalConfig may apply in the future when parsing JSON based config. Signed-off-by: John Mulligan <[email protected]>
1 parent 770c6e7 commit 00fc945

File tree

1 file changed

+29
-35
lines changed

1 file changed

+29
-35
lines changed

tests/test_config.py

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -530,42 +530,36 @@ def test_ad_dc_invalid():
530530

531531

532532
def test_ad_dc_bad_member_of():
533-
jdata = """
534-
{
535-
"samba-container-config": "v0",
536-
"configs": {
537-
"demo": {
538-
"instance_features": ["addc"],
539-
"domain_settings": "sink",
540-
"instance_name": "dc1"
533+
jdata = {
534+
"samba-container-config": "v0",
535+
"configs": {
536+
"demo": {
537+
"instance_features": ["addc"],
538+
"domain_settings": "sink",
539+
"instance_name": "dc1",
540+
}
541+
},
542+
"domain_settings": {
543+
"sink": {
544+
"realm": "DOMAIN1.SINK.TEST",
545+
"short_domain": "DOMAIN1",
546+
"admin_password": "Passw0rd",
547+
}
548+
},
549+
"domain_groups": {"sink": [{"name": "friends"}]},
550+
"domain_users": {
551+
"sink": [
552+
{
553+
"name": "ckent",
554+
"password": "1115Rose.",
555+
"given_name": "Clark",
556+
"surname": "Kent",
557+
"member_of": "friends",
558+
}
559+
]
560+
},
541561
}
542-
},
543-
"domain_settings": {
544-
"sink": {
545-
"realm": "DOMAIN1.SINK.TEST",
546-
"short_domain": "DOMAIN1",
547-
"admin_password": "Passw0rd"
548-
}
549-
},
550-
"domain_groups": {
551-
"sink": [
552-
{"name": "friends"}
553-
]
554-
},
555-
"domain_users": {
556-
"sink": [
557-
{
558-
"name": "ckent",
559-
"password": "1115Rose.",
560-
"given_name": "Clark",
561-
"surname": "Kent",
562-
"member_of": "friends"
563-
}
564-
]
565-
}
566-
}
567-
"""
568-
c1 = sambacc.config.GlobalConfig(io.StringIO(jdata))
562+
c1 = sambacc.config.GlobalConfig(initial_data=jdata)
569563
i1 = c1.get("demo")
570564
assert i1.with_addc
571565

0 commit comments

Comments
 (0)