Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
Bug/SK-466 | App settings not working
Browse files Browse the repository at this point in the history
Studio PR (#169)
  • Loading branch information
niklastheman authored May 5, 2023
1 parent 281e7bd commit 266fd74
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
5 changes: 3 additions & 2 deletions generate_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ def get_form_primitives(app_settings, appinstance=[]):
else:
primitives[key]["meta_title"] = key

for disabled_fiels in disabled_fields:
del primitives[key][disabled_fiels]
for disabled_field in disabled_fields:
if disabled_field in primitives[key]:
del primitives[key][disabled_field]

if appinstance and key in appinstance.parameters.keys():
for _key, _ in app_settings[key].items():
Expand Down
26 changes: 26 additions & 0 deletions tests/test_generate_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,32 @@ def test_get_form_primitives_should_remove_two(self):

self.assertTrue(has_expected_keys)

@override_settings(
DISABLED_APP_INSTANCE_FIELDS=[
"accessModes",
"storageClass",
"madeUpValue",
]
)
def test_get_form_primitives_field_not_in_model(self):
app_settings = deepcopy(self.app_settings_pvc)

result = get_form_primitives(app_settings, None)

result_items = result["volume"]
result_keys = result_items.keys()

result_length = len(result_items)
expected_length = 2

self.assertEqual(result_length, expected_length)

has_expected_keys = (
"meta_title" in result_keys and "size" in result_keys
)

self.assertTrue(has_expected_keys)

@override_settings(DISABLED_APP_INSTANCE_FIELDS=[])
def test_get_form_primitives_should_set_default(self):
app_settings = deepcopy(self.app_settings_pvc)
Expand Down

0 comments on commit 266fd74

Please sign in to comment.