@@ -1495,7 +1495,7 @@ def test_update_newsletter_email_bounce_statistics(org_app, handlers):
1495
1495
job = get_cronjob_by_name (org_app ,
1496
1496
'update_newsletter_email_bounce_statistics' )
1497
1497
job .app = org_app
1498
- # tz = ensure_timezone('Europe/Zurich')
1498
+ tz = ensure_timezone ('Europe/Zurich' )
1499
1499
1500
1500
transaction .begin ()
1501
1501
@@ -1505,6 +1505,30 @@ def test_update_newsletter_email_bounce_statistics(org_app, handlers):
1505
1505
recipients .
add (
'[email protected] ' ,
confirmed = True )
1506
1506
recipients .
add (
'[email protected] ' ,
confirmed = True )
1507
1507
1508
+ # create directory entry recipients
1509
+ directories = DirectoryCollection (org_app .session (), type = 'extended' )
1510
+ directory_entries = directories .add (
1511
+ title = 'Baugesuche (Planauflage)' ,
1512
+ structure = """
1513
+ Gesuchsteller/in *= ___
1514
+ """ ,
1515
+ configuration = DirectoryConfiguration (
1516
+ title = "[Gesuchsteller/in]" ,
1517
+ )
1518
+ )
1519
+ directory_entries .add (values = dict (
1520
+ gesuchsteller_in = 'Amon' ,
1521
+ publication_start = datetime (2024 , 4 , 1 , tzinfo = tz ),
1522
+ publication_end = datetime (2024 , 4 , 10 , tzinfo = tz ),
1523
+ ))
1524
+ entry_recipients = EntryRecipientCollection (org_app .session ())
1525
+ entry_recipients .
add (
'[email protected] ' ,
directory_entries .
id ,
1526
+ confirmed = True )
1527
+ entry_recipients .
add (
'[email protected] ' ,
directory_entries .
id ,
1528
+ confirmed = True )
1529
+ entry_recipients .
add (
'[email protected] ' ,
directory_entries .
id ,
1530
+ confirmed = True )
1531
+
1508
1532
transaction .commit ()
1509
1533
close_all_sessions ()
1510
1534
@@ -1517,7 +1541,9 @@ def test_update_newsletter_email_bounce_statistics(org_app, handlers):
1517
1541
{'RecordType' : 'Bounce' , 'ID' : 3719297970 ,
1518
1542
'Inactive' :
False ,
'Email' :
'[email protected] ' },
1519
1543
{'RecordType' : 'Bounce' , 'ID' : 4739297971 ,
1520
- 'Inactive' :
True ,
'Email' :
'[email protected] ' }
1544
+ 'Inactive' :
True ,
'Email' :
'[email protected] ' },
1545
+ {'RecordType' : 'Bounce' , 'ID' : 5739297972 ,
1546
+ 'Inactive' :
True ,
'Email' :
'[email protected] ' }
1521
1547
]
1522
1548
},
1523
1549
raise_for_status = Mock (return_value = None ),
@@ -1534,6 +1560,12 @@ def test_update_newsletter_email_bounce_statistics(org_app, handlers):
1534
1560
'[email protected] ' ).
is_inactive is True
1535
1561
assert RecipientCollection (org_app .session ()).by_address (
1536
1562
'[email protected] ' ).
is_inactive is False
1563
+ assert EntryRecipientCollection (org_app .session ()).by_address (
1564
+ '[email protected] ' ).
is_inactive is False
1565
+ assert EntryRecipientCollection (org_app .session ()).by_address (
1566
+ '[email protected] ' ).
is_inactive is True
1567
+ assert EntryRecipientCollection (org_app .session ()).by_address (
1568
+ '[email protected] ' ).
is_inactive is False
1537
1569
1538
1570
# test raising runtime warning exception for status code 401
1539
1571
with patch ('requests.get' ) as mock_get :
@@ -1562,6 +1594,18 @@ def test_update_newsletter_email_bounce_statistics(org_app, handlers):
1562
1594
with pytest .raises (requests .exceptions .HTTPError ):
1563
1595
client .get (get_cronjob_url (job ))
1564
1596
1597
+ recipients = RecipientCollection (org_app .session ())
1598
+ assert recipients .query ().count () == 3
1599
+ assert recipients .
by_address (
'[email protected] ' ).
is_inactive is False
1600
+ assert recipients .
by_address (
'[email protected] ' ).
is_inactive is True
1601
+ assert recipients .
by_address (
'[email protected] ' ).
is_inactive is False
1602
+
1603
+ entry_recipients = EntryRecipientCollection (org_app .session ())
1604
+ assert entry_recipients .query ().count () == 3
1605
+ assert entry_recipients .
by_address (
'[email protected] ' ).
is_inactive is False
1606
+ assert entry_recipients .
by_address (
'[email protected] ' ).
is_inactive is True
1607
+ assert entry_recipients .
by_address (
'[email protected] ' ).
is_inactive is False
1608
+
1565
1609
1566
1610
def test_delete_unconfirmed_subscribers (org_app , handlers ):
1567
1611
register_echo_handler (handlers )
0 commit comments