Skip to content

Commit

Permalink
Update unit tests to account for hana config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 6, 2024
1 parent 1f225ad commit 8144bd1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions neon_diana_utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ def generate_mq_auth_config(rmq_config: dict) -> dict:
def generate_users_service_config() -> dict:
"""
Generate users service configuration.
:returns: Configuration for users-service
"""
confirmed = False
module = "mongodb"
Expand Down
16 changes: 11 additions & 5 deletions tests/test_diana_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,26 @@ def test_generate_mq_auth_config(self):
self.assertEqual(user['name'], service_auth['user'])
self.assertEqual(user['password'], service_auth['password'])

@patch("neon_diana_utils.configuration.click.prompt")
@patch("neon_diana_utils.configuration.click.confirm")
def test_generate_users_service_config(self, confirm, prompt):
from neon_diana_utils.configuration import generate_users_service_config
# TODO

@patch("neon_diana_utils.configuration.click.prompt")
@patch("neon_diana_utils.configuration.click.confirm")
def test_generate_hana_config(self, confirm, prompt):
from neon_diana_utils.configuration import generate_hana_config

# Test all confirmed
confirm.return_value = True
prompt.side_effect = ['neon', 'neon', 60, 6]
prompt.side_effect = [60, 6]
hana_config = generate_hana_config()
self.assertIsInstance(hana_config['hana'], dict)
hana_config = hana_config['hana']
self.assertTrue(hana_config['enable_email'])
self.assertEqual(hana_config['node_username'], 'neon')
self.assertEqual(hana_config['node_password'], 'neon')
# self.assertEqual(hana_config['node_username'], 'neon')
# self.assertEqual(hana_config['node_password'], 'neon')
self.assertIsInstance(hana_config['access_token_secret'], str)
self.assertIsInstance(hana_config['refresh_token_secret'], str)
self.assertEqual(hana_config['requests_per_minute'], 60)
Expand All @@ -212,8 +218,8 @@ def test_generate_hana_config(self, confirm, prompt):
self.assertIsInstance(hana_config['hana'], dict)
hana_config = hana_config['hana']
self.assertFalse(hana_config['enable_email'])
self.assertIsNone(hana_config['node_username'])
self.assertIsNone(hana_config['node_password'])
# self.assertIsNone(hana_config['node_username'])
# self.assertIsNone(hana_config['node_password'])
self.assertIsInstance(hana_config['access_token_secret'], str)
self.assertIsInstance(hana_config['refresh_token_secret'], str)
self.assertEqual(hana_config['requests_per_minute'], 30)
Expand Down

0 comments on commit 8144bd1

Please sign in to comment.