Use __exact when looking for bugzilla mail
We need to look for exact match when looking for bugzilla mail. This should also be quicker than normal search. Signed-off-by: Michal Konečný <mkonecny@redhat.com>
This commit is contained in:
parent
109aed5898
commit
869e71ba92
2 changed files with 2 additions and 2 deletions
|
@ -202,7 +202,7 @@ class TestFedoraAccountFASJSON:
|
||||||
assert output == {"username": "scoady", "rhbzemail": "scoady@fp.o"}
|
assert output == {"username": "scoady", "rhbzemail": "scoady@fp.o"}
|
||||||
|
|
||||||
server.search.assert_has_calls(
|
server.search.assert_has_calls(
|
||||||
[call(email="scoady@fp.o"), call(rhbzemail="scoady@fp.o")]
|
[call(email="scoady@fp.o"), call(rhbzemail__exact="scoady@fp.o")]
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch("toddlers.utils.fedora_account.get_fasjson")
|
@patch("toddlers.utils.fedora_account.get_fasjson")
|
||||||
|
|
|
@ -101,7 +101,7 @@ def get_user_by_email(email: str) -> Optional[dict]:
|
||||||
result = fasjson.search(email=email).result or []
|
result = fasjson.search(email=email).result or []
|
||||||
if not result:
|
if not result:
|
||||||
# Try the bugzilla email as well
|
# Try the bugzilla email as well
|
||||||
result = fasjson.search(rhbzemail=email).result or []
|
result = fasjson.search(rhbzemail__exact=email).result or []
|
||||||
if result:
|
if result:
|
||||||
user = result[0]
|
user = result[0]
|
||||||
except ClientError:
|
except ClientError:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue