This commit is contained in:
parent
b0652add43
commit
8478e8d76e
@ -88,6 +88,7 @@ def seed_user(auth_id,
|
|||||||
|
|
||||||
|
|
||||||
def seed(dev: bool):
|
def seed(dev: bool):
|
||||||
|
with app.app_context():
|
||||||
seed_contacttypes()
|
seed_contacttypes()
|
||||||
|
|
||||||
skill_seed_file_path = app.config["KI_DATA_DIR"] + "/seed_data/skills.csv"
|
skill_seed_file_path = app.config["KI_DATA_DIR"] + "/seed_data/skills.csv"
|
||||||
@ -136,7 +137,8 @@ def seed(dev: bool):
|
|||||||
skills=[(3, 3), (1, 5)],
|
skills=[(3, 3), (1, 5)],
|
||||||
searchtopics=[3, 1],
|
searchtopics=[3, 1],
|
||||||
languages=[("de", 5), ("fr", 3)],
|
languages=[("de", 5), ("fr", 3)],
|
||||||
address=("Peter Nichtlustig", "Waldweg", "23i", "Hinterhaus", "13337", "Bielefeld", "Deutschland"),
|
address=("Peter Nichtlustig", "Waldweg", "23i", "Hinterhaus", "13337", "Bielefeld",
|
||||||
|
"Deutschland"),
|
||||||
contacts=[(4, "@peter:wtf-eg.de"), (1, "peter@wtf-eg.de")])
|
contacts=[(4, "@peter:wtf-eg.de"), (1, "peter@wtf-eg.de")])
|
||||||
|
|
||||||
seed_user("dirtydieter",
|
seed_user("dirtydieter",
|
||||||
|
@ -31,6 +31,7 @@ class ApiTest(unittest.TestCase):
|
|||||||
self.max_skill_id = max_skill.id
|
self.max_skill_id = max_skill.id
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
with app.app_context():
|
||||||
db.drop_all()
|
db.drop_all()
|
||||||
db.engine.dispose()
|
db.engine.dispose()
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ class TestProfileEndpoint(ApiTest):
|
|||||||
self.assertEqual(login_response.status_code, 200)
|
self.assertEqual(login_response.status_code, 200)
|
||||||
self.assertIn("token", login_response.json)
|
self.assertIn("token", login_response.json)
|
||||||
|
|
||||||
|
with app.app_context():
|
||||||
babsi = User.query.filter(User.auth_id == "babsi1").first()
|
babsi = User.query.filter(User.auth_id == "babsi1").first()
|
||||||
response = self.client.post(f"/users/{babsi.id}/profile",
|
response = self.client.post(f"/users/{babsi.id}/profile",
|
||||||
data=json.dumps({}),
|
data=json.dumps({}),
|
||||||
@ -103,6 +104,7 @@ class TestProfileEndpoint(ApiTest):
|
|||||||
"level": 2
|
"level": 2
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
with app.app_context():
|
||||||
peter = User.query.filter(User.auth_id == "peter").first()
|
peter = User.query.filter(User.auth_id == "peter").first()
|
||||||
response = self.client.post(f"/users/{peter.id}/profile",
|
response = self.client.post(f"/users/{peter.id}/profile",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
@ -185,6 +187,7 @@ class TestProfileEndpoint(ApiTest):
|
|||||||
def test_get_visible_proifle(self):
|
def test_get_visible_proifle(self):
|
||||||
token = self.login("peter", "geheim")["token"]
|
token = self.login("peter", "geheim")["token"]
|
||||||
|
|
||||||
|
with app.app_context():
|
||||||
babsi = User.query.filter(User.auth_id == "babsi1").first()
|
babsi = User.query.filter(User.auth_id == "babsi1").first()
|
||||||
response = self.client.get(f"/users/{babsi.id}/profile", headers={"Authorization": f"Bearer {token}"})
|
response = self.client.get(f"/users/{babsi.id}/profile", headers={"Authorization": f"Bearer {token}"})
|
||||||
|
|
||||||
@ -197,6 +200,7 @@ class TestProfileEndpoint(ApiTest):
|
|||||||
self.assertEqual(login_response.status_code, 200)
|
self.assertEqual(login_response.status_code, 200)
|
||||||
self.assertIn("token", login_response.json)
|
self.assertIn("token", login_response.json)
|
||||||
|
|
||||||
|
with app.app_context():
|
||||||
peter = User.query.filter(User.auth_id == "peter").first()
|
peter = User.query.filter(User.auth_id == "peter").first()
|
||||||
response = self.client.get(f"/users/{peter.id}/profile",
|
response = self.client.get(f"/users/{peter.id}/profile",
|
||||||
headers={"Authorization": "Bearer " + login_response.json["token"]})
|
headers={"Authorization": "Bearer " + login_response.json["token"]})
|
||||||
|
Loading…
Reference in New Issue
Block a user