def test_user_create(self): """ query_submitted = {"params": {"passwd": "password007", "alias": "james", "name": "James Bond", "usrgrps": [{"usrgrpid": 7}, {"usrgrpid": 12}]}, "jsonrpc": "2.0", "id": 0, "auth": "f016981c4f0d3f8b9682e34588fe8a33", "method": "user.create"} """ module_return = ["3"] query_return = { "jsonrpc": "2.0", "result": { "userids": ["3"] }, "id": 0 } with patch.object(zabbix, "_query", return_value=query_return): with patch.object(zabbix, "_login", return_value=CONN_ARGS): self.assertEqual( zabbix.user_create("james", "password007", "[7, 12]", firstname="James Bond", **CONN_ARGS), module_return, )
def test_user_create(conn_args, set_zabbix_version, query_return, mock_login): """ query_submitted = {"params": {"passwd": "password007", "alias": "james", "name": "James Bond", "usrgrps": [{"usrgrpid": 7}, {"usrgrpid": 12}]}, "jsonrpc": "2.0", "id": 0, "auth": "f016981c4f0d3f8b9682e34588fe8a33", "method": "user.create"} """ module_return = ["3"] query_return({"jsonrpc": "2.0", "result": {"userids": ["3"]}, "id": 0}) set_zabbix_version("3.2") assert (zabbix.user_create("james", "password007", "[7, 12]", firstname="James Bond", **conn_args) == module_return)