How to use update_user_password method in tempest

Best Python code snippet using tempest_python

test_sys_admin_delete.py

Source:test_sys_admin_delete.py Github

copy

Full Screen

1from api.api_get_data import getter2import pytest3import allure4@pytest.mark.usefixtures('add_user')5@pytest.mark.usefixtures('add_test_role')6@pytest.mark.usefixtures("add_dictionaries_company")7class TestSysAdminDeleteFail(object):8 """9 不能删除的情况10 参数列表11 "id": "string",12 "token": "string",13 "userid": "string"14 """15 @pytest.mark.parametrize(('login_phone', 'login_password', 'update_user_phone',16 'update_user_password', 'except_message', 'except_status'),17 getter.load_yaml('SystemManagementData.yml')['test_sys_admin_delete']['test_sys_admin_delete_fail'])18 def test_delete_fail(self, login_phone, login_password, update_user_phone, update_user_password,19 except_message, except_status):20 with allure.step("step1: 步骤1 ==>> 登录并获取token,userid,cookies"):21 token, userId, cookies = getter.get_login_token_cookies(login_phone, login_password, True)22 with allure.step("step2: 步骤2 ==>> 登录被删除用户,获取该用户id,特殊情况判断,自己删除自己账号"):23 if login_phone == update_user_phone:24 update_user_id = userId25 else:26 update_user_id = getter.user_login(phone=update_user_phone, password=update_user_password,27 rememberMe=False).json()['data']['sysAdmin']['id']28 with allure.step("step3: 步骤3 ==>> 删除其他用户"):29 rsp_delete = getter.user_delete(cookies, id=update_user_id, token=token, userid=userId)30 print(rsp_delete.json())31 assert rsp_delete.status_code == 20032 assert rsp_delete.json()['data'] is None33 assert rsp_delete.json()['message'] == except_message34 assert rsp_delete.json()['status'] == except_status35@pytest.mark.usefixtures('add_user')36class TestSysAdminDeleteSuccess(object):37 """38 可以成功删除的情况39 参数列表S40 "id": "string",41 "token": "string",42 "userid": "string"43 """44 @pytest.mark.parametrize(('login_phone', 'login_password', 'update_user_phone', 'update_user_password',45 'delete_except_message', 'delete_except_status',46 'login_except_message', 'login_except_status'),47 getter.load_yaml('SystemManagementData.yml')['test_sys_admin_delete']['test_sys_admin_delete_success'])48 def test_delete_success(self, login_phone, login_password, update_user_phone, update_user_password,49 delete_except_message, delete_except_status, login_except_message, login_except_status):50 with allure.step("step1: 步骤1 ==>> 登录并获取token,userid,cookies"):51 token, userId, cookies = getter.get_login_token_cookies(login_phone, login_password, True)52 with allure.step("step2: 步骤2 ==>> 登录被删除用户,获取该用户id"):53 update_user_id = getter.user_login(phone=update_user_phone, password=update_user_password,54 rememberMe=False).json()['data']['sysAdmin']['id']55 with allure.step("step3: 步骤3 ==>> 删除其他用户"):56 rsp_delete = getter.user_delete(cookies, id=update_user_id, token=token, userid=userId)57 with allure.step("step4: 步骤4 ==>> 登录被删除的用户账号"):58 rsp_login = getter.user_login(phone=update_user_phone, password=update_user_password, rememberMe=True)59 assert rsp_delete.status_code == 20060 assert rsp_delete.json()['data'] is None61 assert rsp_delete.json()['message'] == delete_except_message62 assert rsp_delete.json()['status'] == delete_except_status63 assert rsp_login.status_code == 20064 assert rsp_login.json()['data'] is None65 assert rsp_login.json()['message'] == login_except_message66 assert rsp_login.json()['status'] == login_except_status67if __name__ == '__main__':...

Full Screen

Full Screen

routes_user.py

Source:routes_user.py Github

copy

Full Screen

...52 result = request.query.get('result', '')53 result = unquote_plus(result)54 body = JinjaTemplateRender.render('register.html', result=result)55 return html_response(body)56def update_user_password(request):57 # route_admin_update58 """59 管理员修改用户信息60 """61 result = ''62 # 取到管理员输入的用户 id 和新密码63 form = request.form()64 # 重置密码加盐65 salted_pw = str(User.salted_password(form['password']))66 # 调用 User 的 update 方法,修改用户密码67 User.update(form, salted_pw)68 # 返回到管理员查看用户信息的页面69 result += 'password_modified'70 return redirect('/admin/edit_password?result={}'.format(result))...

Full Screen

Full Screen

urls.py

Source:urls.py Github

copy

Full Screen

1from django.conf.urls import url2from . import views3urlpatterns = [4 url(r'^index/$', views.index, name='index'),5 url(r'^user_login/$', views.user_login, name='user_login'),6 url(r'^user_logout/$', views.user_logout, name='user_logout'),7 url(r'^user_register/$', views.user_register, name='user_register'),8 url(r'^user_self', views.user_self, name='user_self'),9 url(r'^update_user_self', views.update_user_self, name='update_user_self'),10 url(r'^update_user_header', views.update_user_header, name='update_user_header'),11 url(r'^update_user_password', views.update_user_password, name='update_user_password'),12 url(r'^goods_car/$', views.goods_car, name='goods_car'),13 url(r'^cancel_buy/(\d+)/$', views.cancel_buy, name='cancel_buy'),14 url(r'^send_msg/(\d+)/$', views.send_msg, name='send_msg'),15 url(r'^add_address/(\d+)/$', views.add_address, name='add_address'),16 url(r'^address_list/(\d+)/$', views.address_list, name='address_list'),17 url(r'^code/$', views.code, name='code'),18 url(r'^$', views.index)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful