Skip to content

Commit

Permalink
chore: refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ab committed Jul 27, 2023
1 parent 8c41383 commit a07dd39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/configGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def updateUiConfig(field):
db_config['config']['destConfig']['defaultConfig'][-1])

db_config = json.dumps(db_config)
ui_config = json.dumps(ui_config)
return {'db_config':db_config, 'ui_config': ui_config}


Expand All @@ -80,11 +81,10 @@ def updateUiConfig(field):


file_path = f'src/configurations/destinations/{data["displayName"]}/ui-config.json'
ui_config = json.dumps(configData['ui_config'])
directory = os.path.dirname(file_path)
if not os.path.exists(directory):
os.makedirs(directory)

with open(file_path, 'w') as file:
# Write the new content
file.write(ui_config)
file.write(configData['ui_config'])
2 changes: 1 addition & 1 deletion test/test_configGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestConfigGenerator(unittest.TestCase):
def test_config_generator(self):
result = generateConfigs(input_data)
self.assertEqual(result['db_config'], json.dumps(db_config))
self.assertEqual(json.dumps(result['ui_config']), json.dumps(ui_config))
self.assertEqual(result['ui_config'], json.dumps(ui_config))

if __name__ == '__main__':
unittest.main()

0 comments on commit a07dd39

Please sign in to comment.