Skip to content

Commit

Permalink
users: Fix users filter in brevo command
Browse files Browse the repository at this point in the history
  • Loading branch information
tonial committed Dec 12, 2024
1 parent 6bb0012 commit 0dc10f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion itou/users/management/commands/new_users_to_brevo.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ def handle(self, *args, wet_run, **options):
verified=True,
)
)
| Q(identity_provider=IdentityProvider.INCLUSION_CONNECT), # IC verifies emails on its own
| Q(
identity_provider__in=[IdentityProvider.INCLUSION_CONNECT, IdentityProvider.PRO_CONNECT]
), # the SSO verifies emails on its own
is_active=True,
)
.order_by("email")
Expand Down
12 changes: 6 additions & 6 deletions tests/users/test_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def test_wet_run_siae(self, caplog, respx_mock):
# Job seekers are ignored.
JobSeekerFactory(with_verified_email=True)
for kind in set(CompanyKind) - set(SIAE_WITH_CONVENTION_KINDS):
CompanyMembershipFactory(company__kind=kind, user__identity_provider=IdentityProvider.INCLUSION_CONNECT)
CompanyMembershipFactory(company__kind=kind, user__identity_provider=IdentityProvider.PRO_CONNECT)
# Missing verified email and not using IC
CompanyMembershipFactory(company__kind=CompanyKind.EI, user__identity_provider=IdentityProvider.DJANGO)
not_primary = CompanyMembershipFactory(
Expand All @@ -397,31 +397,31 @@ def test_wet_run_siae(self, caplog, respx_mock):
first_name="Annie",
last_name="Amma",
email="[email protected]",
identity_provider=IdentityProvider.INCLUSION_CONNECT,
identity_provider=IdentityProvider.PRO_CONNECT,
)
bob = EmployerFactory(
first_name="Bob",
last_name="Bailey",
email="[email protected]",
identity_provider=IdentityProvider.INCLUSION_CONNECT,
identity_provider=IdentityProvider.PRO_CONNECT,
)
cindy = EmployerFactory(
first_name="Cindy",
last_name="Cinnamon",
email="[email protected]",
identity_provider=IdentityProvider.INCLUSION_CONNECT,
identity_provider=IdentityProvider.PRO_CONNECT,
)
dave = EmployerFactory(
first_name="Dave",
last_name="Doll",
email="[email protected]",
identity_provider=IdentityProvider.INCLUSION_CONNECT,
identity_provider=IdentityProvider.PRO_CONNECT,
)
eve = EmployerFactory(
first_name="Eve",
last_name="Ebi",
email="[email protected]",
identity_provider=IdentityProvider.INCLUSION_CONNECT,
identity_provider=IdentityProvider.PRO_CONNECT,
)
CompanyMembershipFactory(user=annie, company__kind=CompanyKind.EI)
CompanyMembershipFactory(user=bob, company__kind=CompanyKind.AI)
Expand Down

0 comments on commit 0dc10f1

Please sign in to comment.