Merge branch 'dev' into runny827
feat(training): 新增精益培训视频与周任务管理 # Conflicts: # backend/app/models/__init__.py
This commit is contained in:
1 parent
85d27e9ffa
commit
91b7233872
812 files changed
+73763
-18908
No files matched your search
@@ -92,6 +92,34 @@ def test_change_password_local_mode(client):
|
||||
|
||||
|
||||
|
||||
def test_change_password_rejects_unchanged_password(client):
|
||||
|
||||
"""新密码与原密码相同时应 400,且不改哈希。"""
|
||||
|
||||
headers = _auth_headers(client)
|
||||
|
||||
res = client.post(
|
||||
|
||||
'/api/user/change-password',
|
||||
|
||||
headers=headers,
|
||||
|
||||
json={'current_password': 'old-password', 'new_password': 'old-password'},
|
||||
|
||||
)
|
||||
|
||||
assert res.status_code == 400
|
||||
|
||||
assert (res.get_json() or {}).get('error', {}).get('code') == 'AUTH.PASSWORD_UNCHANGED'
|
||||
|
||||
user = db.session.query(User).filter_by(username='testuser').first()
|
||||
|
||||
assert user.check_password('old-password')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def test_change_password_local_mode_syncs_casdoor(client, monkeypatch):
|
||||
|
||||
client.application.config['CASDOOR_BASE_URL'] = 'http://casdoor.test'
|
||||
|
||||
Reference in new issue
Block a user