mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-12 15:05:07 +00:00
* add hdbuserstore ability
* add description
* fix
* add default
* add description
* add sample
* Apply suggestions from code review
Co-authored-by: quidame <quidame@poivron.org>
* add fragment, fix required if
* remove whitespace
* add coding fragment
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* added test for userstore
* Update plugins/modules/database/saphana/hana_query.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Rainer Leber <rainer.leber@sva.de>
Co-authored-by: quidame <quidame@poivron.org>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e9494c12f2)
Co-authored-by: rainerleber <39616583+rainerleber@users.noreply.github.com>
This commit is contained in:
parent
f493110651
commit
3495823a72
3 changed files with 72 additions and 8 deletions
|
|
@ -64,3 +64,39 @@ class Testhana_query(ModuleTestCase):
|
|||
{'username': 'myuser', 'name': 'my user'},
|
||||
]])
|
||||
self.assertEqual(run_command.call_count, 1)
|
||||
|
||||
def test_hana_userstore_query(self):
|
||||
"""Check that result is processed with userstore."""
|
||||
set_module_args({
|
||||
'sid': "HDB",
|
||||
'instance': "01",
|
||||
'encrypted': False,
|
||||
'host': "localhost",
|
||||
'user': "SYSTEM",
|
||||
'userstore': True,
|
||||
'database': "HDB",
|
||||
'query': "SELECT * FROM users;"
|
||||
})
|
||||
with patch.object(basic.AnsibleModule, 'run_command') as run_command:
|
||||
run_command.return_value = 0, 'username,name\n testuser,test user \n myuser, my user \n', ''
|
||||
with self.assertRaises(AnsibleExitJson) as result:
|
||||
hana_query.main()
|
||||
self.assertEqual(result.exception.args[0]['query_result'], [[
|
||||
{'username': 'testuser', 'name': 'test user'},
|
||||
{'username': 'myuser', 'name': 'my user'},
|
||||
]])
|
||||
self.assertEqual(run_command.call_count, 1)
|
||||
|
||||
def test_hana_failed_no_passwd(self):
|
||||
"""Check that result is failed with no password."""
|
||||
with self.assertRaises(AnsibleFailJson):
|
||||
set_module_args({
|
||||
'sid': "HDB",
|
||||
'instance': "01",
|
||||
'encrypted': False,
|
||||
'host': "localhost",
|
||||
'user': "SYSTEM",
|
||||
'database': "HDB",
|
||||
'query': "SELECT * FROM users;"
|
||||
})
|
||||
self.module.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue