| |
@@ -1,4 +1,5 @@
|
| |
- from unittest.mock import Mock, patch
|
| |
+ import logging
|
| |
+ from unittest.mock import call, Mock, patch
|
| |
|
| |
import pytest
|
| |
|
| |
@@ -61,10 +62,12 @@
|
| |
get_bz_email,
|
| |
get_fas_grp_mbr,
|
| |
toddler,
|
| |
+ caplog,
|
| |
):
|
| |
+ caplog.set_level(logging.DEBUG)
|
| |
toml_load.return_value = {}
|
| |
- get_fas_grp_mbr.return_value = ["pingou", "nils"]
|
| |
- get_bz_email.side_effect = ["pingou@fp.o", "nils@fp.o"]
|
| |
+ get_fas_grp_mbr.return_value = ["pingou", "nils", "ralph"]
|
| |
+ get_bz_email.side_effect = ["pingou@fp.o", "nils@fp.o", "ralph@redhat.com"]
|
| |
get_bz_grp_mbr.return_value = ["pingou@fp.o", "nphilipp@fp.o"]
|
| |
|
| |
toddler.process(
|
| |
@@ -76,7 +79,9 @@
|
| |
|
| |
toml_load.assert_called_with("test")
|
| |
get_fas_grp_mbr.assert_called_with("packager")
|
| |
- get_bz_email.assert_called_with("pingou", {})
|
| |
+ get_bz_email.assert_has_calls(
|
| |
+ calls=[call("nils", {}), call("pingou", {}), call("ralph", {})]
|
| |
+ )
|
| |
get_bz_grp_mbr.assert_called_with("fedora_contrib")
|
| |
bz_user_grp.assert_called_with(
|
| |
user_email="nils@fp.o",
|
| |
@@ -85,6 +90,8 @@
|
| |
dry_run=False,
|
| |
)
|
| |
|
| |
+ assert " ignoring ralph@redhat.com, as all @redhat.com accounts" in caplog.text
|
| |
+
|
| |
@patch("toddlers.utils.fedora_account.set_fas", new=Mock(return_value=True))
|
| |
@patch("toddlers.utils.bugzilla_system.set_bz", new=Mock(return_value=True))
|
| |
@patch("toddlers.utils.fedora_account.get_bz_email_user")
|
| |
Accounts with an @redhat.com email address are special accounts in
Red Hat's bugzilla and handled directly by Red Hat IT.
So in our side, we should not do anything with them.
The issue is that when an associate leaves Red Hat, their bugzilla account
is deactivated. It should not belong to any group, not appear anywhere.
If we automatically add them back to a group, this causes problems on the
bugzilla side.
This commit makes it so, all @redhat.com accounts will be ignored.
Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr