#NEWLINE# def test_add_task_filter_device( self ) : #NEWLINE# #INDENT# device = Device . objects . create ( key = 'TEST_DEVICE_KEY' , type = Device . DEVICE_TYPE_IOS ) #NEWLINE# mock_task = mock . Mock ( ) #NEWLINE# with mock . patch ( 'pushy.tasks.send_single_push_notification.apply_async' , new = mock_task ) as mocked_task : #NEWLINE# #INDENT# send_push_notification ( 'some other test push notification' , self . payload , device = mock_task ) #NEWLINE# notification = PushNotification . objects . latest ( 'id' ) #NEWLINE# mocked_task . assert_called_with ( kwargs = { #NEWLINE# #INDENT# 'device' : device . id , #NEWLINE# 'payload' : notification . payload , #NEWLINE# #UNINDENT# } )