refactor(config_management): Adjust rendered config str -> dict
ref: #248 #353
This commit is contained in:
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -17,4 +17,5 @@
|
||||
"ITSM"
|
||||
],
|
||||
"cSpell.language": "en-AU",
|
||||
"jest.enable": false,
|
||||
}
|
@ -245,13 +245,13 @@ class ConfigGroups(GroupsCommonFields, SaveHistory):
|
||||
return self.parent
|
||||
|
||||
|
||||
def render_config(self) -> str:
|
||||
def render_config(self):
|
||||
|
||||
config: dict = dict()
|
||||
|
||||
if self.parent:
|
||||
|
||||
config.update(json.loads(ConfigGroups.objects.get(id=self.parent.id).render_config()))
|
||||
config.update(ConfigGroups.objects.get(id=self.parent.id).render_config())
|
||||
|
||||
if self.config:
|
||||
|
||||
@ -294,7 +294,7 @@ class ConfigGroups(GroupsCommonFields, SaveHistory):
|
||||
|
||||
config['software'] = merge_software(config['software'], software_actions['software'])
|
||||
|
||||
return json.dumps(config)
|
||||
return config
|
||||
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ class ConfigGroupsModel(
|
||||
def test_config_groups_rendered_config_is_dict(self):
|
||||
""" Rendered Config is a string """
|
||||
|
||||
assert type(self.item.render_config()) is str
|
||||
assert type(self.item.render_config()) is dict
|
||||
|
||||
|
||||
def test_config_groups_rendered_config_is_correct(self):
|
||||
|
@ -155,7 +155,7 @@ class View(ChangeView):
|
||||
|
||||
context['child_groups'] = ConfigGroups.objects.filter(parent=self.kwargs['pk'])
|
||||
|
||||
context['config'] = json.dumps(json.loads(self.object.render_config()), indent=4, sort_keys=True)
|
||||
context['config'] = json.dumps(self.object.render_config(), indent=4, sort_keys=True)
|
||||
|
||||
|
||||
context['tickets'] = TicketLinkedItem.objects.filter(
|
||||
|
Reference in New Issue
Block a user