def test_usergroup_get(conn_args, set_zabbix_version, query_return, mock_login): """ query_submitted = {"params": {"filter": {"name": "testgroup"}, "output": "extend", "selectRights": "extend"}, "jsonrpc": "2.0", "id": 0, "auth": "739cf358050f2a2d33162fdcfa714a3c", "method": "usergroup.get"} """ module_return = [{ "name": "testgroup", "rights": [], "users_status": "0", "gui_access": "0", "debug_mode": "0", "usrgrpid": "13", }] query_return({ "jsonrpc": "2.0", "result": [{ "usrgrpid": "13", "name": "testgroup", "gui_access": "0", "users_status": "0", "debug_mode": "0", "rights": [], }], "id": 0, }) set_zabbix_version("3.2") assert zabbix.usergroup_get("testgroup", **conn_args) == module_return
def test_usergroup_get(self): """ query_submitted = {"params": {"filter": {"name": "testgroup"}, "output": "extend", "selectRights": "extend"}, "jsonrpc": "2.0", "id": 0, "auth": "739cf358050f2a2d33162fdcfa714a3c", "method": "usergroup.get"} """ module_return = [ { "name": "testgroup", "rights": [], "users_status": "0", "gui_access": "0", "debug_mode": "0", "usrgrpid": "13", } ] query_return = { "jsonrpc": "2.0", "result": [ { "usrgrpid": "13", "name": "testgroup", "gui_access": "0", "users_status": "0", "debug_mode": "0", "rights": [], } ], "id": 0, } with patch.object(zabbix, "apiinfo_version", return_value="3.2"): with patch.object(zabbix, "_query", return_value=query_return): with patch.object(zabbix, "_login", return_value=CONN_ARGS): self.assertEqual( zabbix.usergroup_get("testgroup", **CONN_ARGS), module_return )