Klarnamen in der Suche berücksichtigen #68
@ -59,6 +59,8 @@ def seed_user(nickname,
|
|||||||
|
|
||||||
db.session.add(profile)
|
db.session.add(profile)
|
||||||
|
|
||||||
|
return profile
|
||||||
|
|
||||||
|
|
||||||
def seed(dev: bool):
|
def seed(dev: bool):
|
||||||
seed_contacttypes()
|
seed_contacttypes()
|
||||||
@ -145,7 +147,7 @@ def seed(dev: bool):
|
|||||||
for i in range(1, 20):
|
for i in range(1, 20):
|
||||||
seed_user(f"babsi{i}", visible=True)
|
seed_user(f"babsi{i}", visible=True)
|
||||||
|
|
||||||
seed_user("dirtydieter",
|
dieter = seed_user("dirtydieter",
|
||||||
visible=True,
|
visible=True,
|
||||||
volunteerwork="Müll sammeln",
|
volunteerwork="Müll sammeln",
|
||||||
availability_status=True,
|
availability_status=True,
|
||||||
@ -154,6 +156,9 @@ def seed(dev: bool):
|
|||||||
freetext="1001010010111!!!",
|
freetext="1001010010111!!!",
|
||||||
skills=[(Skill.skill_id_php, 5)])
|
skills=[(Skill.skill_id_php, 5)])
|
||||||
|
|
||||||
|
dieters_address = Address(name="Friedrich Witzig", profile=dieter)
|
||||||
zeitschlag marked this conversation as resolved
Outdated
|
|||||||
|
db.session.add(dieters_address)
|
||||||
|
|
||||||
all_skills = Skill.query.all()
|
all_skills = Skill.query.all()
|
||||||
all_profile_skills = []
|
all_profile_skills = []
|
||||||
for skill in all_skills:
|
for skill in all_skills:
|
||||||
|
@ -99,6 +99,14 @@ class TestFindProfilesEndpoint(ApiTest):
|
|||||||
self.assertDictContainsSubset({"nickname": "jutta"}, response.json["profiles"][0])
|
self.assertDictContainsSubset({"nickname": "jutta"}, response.json["profiles"][0])
|
||||||
self.assertDictContainsSubset({"nickname": "monique"}, response.json["profiles"][1])
|
self.assertDictContainsSubset({"nickname": "monique"}, response.json["profiles"][1])
|
||||||
|
|
||||||
|
def test_find_peter_by_name(self):
|
||||||
|
token = self.login("peter", "geheim")["token"]
|
||||||
|
|
||||||
|
response = self.client.get("/users/profiles?search=friedrich", headers={"Authorization": "Bearer " + token})
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertDictContainsSubset({"total": 1}, response.json)
|
||||||
|
self.assertDictContainsSubset({"nickname": "dirtydieter"}, response.json["profiles"][0])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "main":
|
if __name__ == "main":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user
Diese Verwendung bricht das existierende Pattern von
seed_user
und vermischt Abstraktionslevel.Die Adresse könnte wie die Skills als Parameter übergeben werden.
Wie besprochen sollten wir die Erstellung von Profilen refactoren.