<s> """<STR_LIT>""" <EOL> from copy import deepcopy <EOL> from django . test import TestCase <EOL> from djstripe . models import EventProcessingException , Event <EOL> class TestEventProcessingException ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . msg = { <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT:data>" : { <EOL> "<STR_LIT:object>" : { <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT:description>" : None , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT:email>" : "<STR_LIT>" , <EOL> "<STR_LIT:id>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT:object>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : None <EOL> } <EOL> } , <EOL> "<STR_LIT:id>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT:object>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT:type>" : "<STR_LIT>" <EOL> } <EOL> self . invalid_customer_msg = { <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT:data>" : { <EOL> "<STR_LIT:object>" : { <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT:description>" : None , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT:email>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT:object>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : None <EOL> } <EOL> } , <EOL> "<STR_LIT:id>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT:object>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT:type>" : "<STR_LIT>" <EOL> } <EOL> self . event = Event . objects . create ( <EOL> stripe_id = self . msg [ "<STR_LIT:id>" ] , <EOL> kind = "<STR_LIT>" , <EOL> webhook_message = self . msg , <EOL> validated_message = self . msg <EOL> ) <EOL> def test_tostring ( self ) : <EOL> try : <EOL> raise IOError ( "<STR_LIT>" ) <EOL> except IOError as error : <EOL> EventProcessingException . log ( data = self . msg [ "<STR_LIT:data>" ] , exception = error , event = self . event ) <EOL> exception = EventProcessingException . objects . get ( event = self . event ) <EOL> self . assertIn ( '<STR_LIT>' , str ( exception ) ) <EOL> self . assertIn ( '<STR_LIT>' , str ( exception ) ) <EOL> def test_non_crud_link_customer_on_non_customer ( self ) : <EOL> self . event . process ( ) <EOL> self . assertEqual ( None , self . event . customer ) <EOL> def test_non_crud_link_customer_on_invalid_customer ( self ) : <EOL> event_copy = deepcopy ( self . event ) <EOL> event_copy . validated_message = self . invalid_customer_msg <EOL> event_copy . save ( ) <EOL> event_copy . process ( ) <EOL> self . assertEqual ( None , event_copy . customer ) </s>
