forked from kompetenzinventar/ki-backend
fix updating nickname #57
This commit is contained in:
parent
9dc9761a1a
commit
1287893698
@ -133,6 +133,7 @@ def update_profile(user_id: int):
|
||||
profile = Profile(user=user, nickname=user.auth_id)
|
||||
db.session.add(profile)
|
||||
|
||||
profile.nickname = request.json.get("nickname", "")
|
||||
profile.pronouns = request.json.get("pronouns", "")
|
||||
profile.volunteerwork = request.json.get("volunteerwork", "")
|
||||
profile.availability_status = request.json.get("availability_status", False)
|
||||
|
@ -31,6 +31,7 @@ class TestProfileEndpoint(ApiTest):
|
||||
token = self.login("peter", "geheim")["token"]
|
||||
|
||||
data = {
|
||||
"nickname": "Hebbert",
|
||||
"pronouns": "Monsieur",
|
||||
"volunteerwork": "ja",
|
||||
"availability_status": False,
|
||||
@ -110,6 +111,7 @@ class TestProfileEndpoint(ApiTest):
|
||||
with app.app_context():
|
||||
user = User.query.filter(User.id == 1).first()
|
||||
profile = user.profile
|
||||
self.assertEqual("Hebbert", profile.nickname)
|
||||
self.assertEqual("Monsieur", profile.pronouns)
|
||||
self.assertEqual("ja", profile.volunteerwork)
|
||||
self.assertEqual(False, profile.availability_status)
|
||||
|
Loading…
Reference in New Issue
Block a user