set user_id when creating AliasUsedOn

This commit is contained in:
Son NK 2020-03-20 12:29:11 +01:00 committed by Son NK
parent b655503d39
commit 6976c28985
3 changed files with 6 additions and 4 deletions

View file

@ -72,7 +72,7 @@ def new_custom_alias():
db.session.commit()
if hostname:
AliasUsedOn.create(alias_id=alias.id, hostname=hostname)
AliasUsedOn.create(alias_id=alias.id, hostname=hostname, user_id=alias.user_id)
db.session.commit()
return jsonify(alias=full_alias), 201

View file

@ -52,7 +52,7 @@ def new_random_alias():
hostname = request.args.get("hostname")
if hostname:
AliasUsedOn.create(alias_id=alias.id, hostname=hostname)
AliasUsedOn.create(alias_id=alias.id, hostname=hostname, user_id=alias.user_id)
db.session.commit()
return jsonify(alias=alias.email), 201

View file

@ -42,7 +42,7 @@ def test_different_scenarios(flask_client):
# <<< with recommendation >>>
alias = Alias.create_new(user, prefix="test")
db.session.commit()
AliasUsedOn.create(alias_id=alias.id, hostname="www.test.com")
AliasUsedOn.create(alias_id=alias.id, hostname="www.test.com", user_id=user.id)
db.session.commit()
r = flask_client.get(
@ -87,7 +87,9 @@ def test_different_scenarios_v2(flask_client):
# <<< with recommendation >>>
alias = Alias.create_new(user, prefix="test")
db.session.commit()
AliasUsedOn.create(alias_id=alias.id, hostname="www.test.com")
AliasUsedOn.create(
alias_id=alias.id, hostname="www.test.com", user_id=alias.user_id
)
db.session.commit()
r = flask_client.get(