def test_usergroup_list(self): """ query_submitted = {"params": {"output": "extend"}, "jsonrpc": "2.0", "id": 0, "auth": "4bc366bc7803c07e80f15b1bc14dc61f", "method": "usergroup.get"} """ module_return = [ { "usrgrpid": "7", "gui_access": "0", "debug_mode": "0", "name": "Zabbix administrators", "users_status": "0", }, { "usrgrpid": "8", "gui_access": "0", "debug_mode": "0", "name": "Guests", "users_status": "0", }, { "usrgrpid": "9", "gui_access": "0", "debug_mode": "0", "name": "Disabled", "users_status": "1", }, { "usrgrpid": "11", "gui_access": "0", "debug_mode": "1", "name": "Enabled debug mode", "users_status": "0", }, { "usrgrpid": "12", "gui_access": "2", "debug_mode": "0", "name": "No access to the frontend", "users_status": "0", }, { "usrgrpid": "13", "gui_access": "0", "debug_mode": "0", "name": "testgroup", "users_status": "0", }, ] # pylint: disable=E8128 query_return = { "jsonrpc": "2.0", "result": [ { "usrgrpid": "7", "name": "Zabbix administrators", "gui_access": "0", "users_status": "0", "debug_mode": "0", }, { "usrgrpid": "8", "name": "Guests", "gui_access": "0", "users_status": "0", "debug_mode": "0", }, { "usrgrpid": "9", "name": "Disabled", "gui_access": "0", "users_status": "1", "debug_mode": "0", }, { "usrgrpid": "11", "name": "Enabled debug mode", "gui_access": "0", "users_status": "0", "debug_mode": "1", }, { "usrgrpid": "12", "name": "No access to the frontend", "gui_access": "2", "users_status": "0", "debug_mode": "0", }, { "usrgrpid": "13", "name": "testgroup", "gui_access": "0", "users_status": "0", "debug_mode": "0", }, ], "id": 0, } with patch.object(zabbix, "_query", return_value=query_return): with patch.object(zabbix, "_login", return_value=CONN_ARGS): self.assertEqual(zabbix.usergroup_list(**CONN_ARGS), module_return)
def test_usergroup_list(conn_args, query_return, mock_login): """ query_submitted = {"params": {"output": "extend"}, "jsonrpc": "2.0", "id": 0, "auth": "4bc366bc7803c07e80f15b1bc14dc61f", "method": "usergroup.get"} """ module_return = [ { "usrgrpid": "7", "gui_access": "0", "debug_mode": "0", "name": "Zabbix administrators", "users_status": "0", }, { "usrgrpid": "8", "gui_access": "0", "debug_mode": "0", "name": "Guests", "users_status": "0", }, { "usrgrpid": "9", "gui_access": "0", "debug_mode": "0", "name": "Disabled", "users_status": "1", }, { "usrgrpid": "11", "gui_access": "0", "debug_mode": "1", "name": "Enabled debug mode", "users_status": "0", }, { "usrgrpid": "12", "gui_access": "2", "debug_mode": "0", "name": "No access to the frontend", "users_status": "0", }, { "usrgrpid": "13", "gui_access": "0", "debug_mode": "0", "name": "testgroup", "users_status": "0", }, ] # pylint: disable=E8128 query_return( { "jsonrpc": "2.0", "result": [ { "usrgrpid": "7", "name": "Zabbix administrators", "gui_access": "0", "users_status": "0", "debug_mode": "0", }, { "usrgrpid": "8", "name": "Guests", "gui_access": "0", "users_status": "0", "debug_mode": "0", }, { "usrgrpid": "9", "name": "Disabled", "gui_access": "0", "users_status": "1", "debug_mode": "0", }, { "usrgrpid": "11", "name": "Enabled debug mode", "gui_access": "0", "users_status": "0", "debug_mode": "1", }, { "usrgrpid": "12", "name": "No access to the frontend", "gui_access": "2", "users_status": "0", "debug_mode": "0", }, { "usrgrpid": "13", "name": "testgroup", "gui_access": "0", "users_status": "0", "debug_mode": "0", }, ], "id": 0, } ) assert zabbix.usergroup_list(**conn_args) == module_return