<s> from datetime import timedelta <EOL> from django . utils import timezone <EOL> from mock import patch <EOL> from hc . api . management . commands . sendalerts import Command <EOL> from hc . api . models import Check <EOL> from hc . test import BaseTestCase <EOL> class SendAlertsTestCase ( BaseTestCase ) : <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_it_handles_few ( self , mock ) : <EOL> yesterday = timezone . now ( ) - timedelta ( days = <NUM_LIT:1> ) <EOL> names = [ "<STR_LIT>" % d for d in range ( <NUM_LIT:0> , <NUM_LIT:10> ) ] <EOL> for name in names : <EOL> check = Check ( user = self . alice , name = name ) <EOL> check . alert_after = yesterday <EOL> check . status = "<STR_LIT>" <EOL> check . save ( ) <EOL> result = Command ( ) . handle_many ( ) <EOL> assert result , "<STR_LIT>" <EOL> handled_names = [ ] <EOL> for args , kwargs in mock . call_args_list : <EOL> handled_names . append ( args [ <NUM_LIT:0> ] . name ) <EOL> assert set ( names ) == set ( handled_names ) </s>
