def test_user_update(self): ''' query_submitted = {"params": {"userid": 3, "name": "James Brown"}, "jsonrpc": "2.0", "id": 0, "auth": "cdf2ee35e3bc47560585e9c457cbc398", "method": "user.update"} ''' 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_update('3', visible_name='James Brown', **CONN_ARGS), module_return)
def test_user_update(conn_args, set_zabbix_version, query_return, mock_login): """ query_submitted = {"params": {"userid": 3, "name": "James Brown"}, "jsonrpc": "2.0", "id": 0, "auth": "cdf2ee35e3bc47560585e9c457cbc398", "method": "user.update"} """ module_return = ["3"] query_return({"jsonrpc": "2.0", "result": {"userids": ["3"]}, "id": 0}) set_zabbix_version("3.4") assert ( zabbix.user_update("3", visible_name="James Brown", medias=[], **conn_args) == module_return )