<s> import unittest <EOL> import urllib <EOL> from createsend import * <EOL> class TransactionalTestCase ( object ) : <EOL> def test_smart_email_list ( self ) : <EOL> status = "<STR_LIT:all>" <EOL> self . tx . stub_request ( "<STR_LIT>" % status , "<STR_LIT>" ) <EOL> list = self . tx . smart_email_list ( status ) <EOL> self . assertEqual ( list [ <NUM_LIT:0> ] . Name , "<STR_LIT>" ) <EOL> def test_active_smart_email_list ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> list = self . tx . smart_email_list ( status = "<STR_LIT>" ) <EOL> self . assertEqual ( list [ <NUM_LIT:0> ] . Status , "<STR_LIT>" ) <EOL> def test_smart_email_list_with_client ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" % self . client_id , "<STR_LIT>" ) <EOL> list = self . tx . smart_email_list ( client_id = self . client_id ) <EOL> self . assertEqual ( list [ <NUM_LIT:0> ] . Name , "<STR_LIT>" ) <EOL> def test_smart_email_details ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" % self . smart_email_id , "<STR_LIT>" ) <EOL> email = self . tx . smart_email_details ( self . smart_email_id ) <EOL> self . assertEqual ( email . Name , "<STR_LIT>" ) <EOL> def test_smart_email_send_single ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" % self . smart_email_id , "<STR_LIT>" ) <EOL> send = self . tx . smart_email_send ( self . smart_email_id , "<STR_LIT>" ) <EOL> self . assertEqual ( send [ <NUM_LIT:0> ] . Status , "<STR_LIT>" ) <EOL> def test_smart_email_send_multiple ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" % self . smart_email_id , "<STR_LIT>" ) <EOL> send = self . tx . smart_email_send ( self . smart_email_id , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEqual ( send [ <NUM_LIT:1> ] . Recipient , "<STR_LIT>" ) <EOL> def test_classic_email_send ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> send = self . tx . classic_email_send ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assertEqual ( send [ <NUM_LIT:0> ] . Recipient , "<STR_LIT>" ) <EOL> def test_classic_email_groups ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> groups = self . tx . classic_email_groups ( ) <EOL> self . assertEqual ( groups [ <NUM_LIT:0> ] . Group , "<STR_LIT>" ) <EOL> def test_classic_email_groups_with_client ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" % self . client_id , "<STR_LIT>" ) <EOL> groups = self . tx . classic_email_groups ( client_id = self . client_id ) <EOL> self . assertEqual ( groups [ <NUM_LIT:0> ] . Group , "<STR_LIT>" ) <EOL> def test_statistics ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> stats = self . tx . statistics ( ) <EOL> self . assertEqual ( stats . Query . Group , "<STR_LIT>" ) <EOL> def test_statistics_with_options ( self ) : <EOL> start = "<STR_LIT>" <EOL> end = "<STR_LIT>" <EOL> self . tx . stub_request ( '<STR_LIT>' % ( end , start , self . client_id ) , "<STR_LIT>" ) <EOL> stats = self . tx . statistics ( { '<STR_LIT>' : self . client_id , '<STR_LIT>' : start , '<STR_LIT:to>' : end } ) <EOL> self . assertEqual ( stats . Query . Group , "<STR_LIT>" ) <EOL> def test_timeline ( self ) : <EOL> self . tx . stub_request ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> timeline = self . tx . message_timeline ( ) <EOL> self . assertEqual ( len ( timeline ) , <NUM_LIT:3> ) <EOL> self . assertEqual ( timeline [ <NUM_LIT:0> ] . Status , "<STR_LIT>" ) <EOL> def test_timeline_classic_with_options ( self ) : <EOL> self . tx . stub_request ( '<STR_LIT>' % ( "<STR_LIT:all>" , "<STR_LIT>" ) , "<STR_LIT>" ) <EOL> timeline = self . tx . message_timeline ( { '<STR_LIT:status>' : '<STR_LIT:all>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( timeline [ <NUM_LIT:0> ] . Group , "<STR_LIT>" ) <EOL> def test_timeline_smart_with_options ( self ) : <EOL> self . tx . stub_request ( '<STR_LIT>' % ( "<STR_LIT:all>" , self . smart_email_id ) , "<STR_LIT>" ) <EOL> timeline = self . tx . message_timeline ( { '<STR_LIT:status>' : '<STR_LIT:all>' , '<STR_LIT>' : self . smart_email_id } ) <EOL> self . assertEqual ( timeline [ <NUM_LIT:0> ] . SmartEmailID , self . smart_email_id ) <EOL> def test_message_details ( self ) : <EOL> self . tx . stub_request ( '<STR_LIT>' % ( self . message_id ) , "<STR_LIT>" ) <EOL> msg = self . tx . message_details ( self . message_id , statistics = False ) <EOL> self . assertEqual ( msg . MessageID , self . message_id ) <EOL> def test_message_details_with_stats ( self ) : <EOL> self . tx . stub_request ( '<STR_LIT>' % ( self . message_id ) , "<STR_LIT>" ) <EOL> msg = self . tx . message_details ( self . message_id , statistics = True ) <EOL> self . assertEqual ( len ( msg . Opens ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( len ( msg . Clicks ) , <NUM_LIT:1> ) <EOL> def test_message_resend ( self ) : <EOL> self . tx . stub_request ( '<STR_LIT>' % ( self . message_id ) , "<STR_LIT>" ) <EOL> send = self . tx . message_resend ( self . message_id ) <EOL> self . assertEqual ( send [ <NUM_LIT:0> ] . Status , "<STR_LIT>" ) <EOL> class OAuthTransactionalTestCase ( unittest . TestCase , TransactionalTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . client_id = '<STR_LIT>' <EOL> self . smart_email_id = '<STR_LIT>' <EOL> self . message_id = '<STR_LIT>' <EOL> self . before_id = '<STR_LIT>' <EOL> self . after_id = '<STR_LIT>' <EOL> self . tx = Transactional ( <EOL> { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } , "<STR_LIT>" ) <EOL> class ApiKeyTransactionalTestCase ( unittest . TestCase , TransactionalTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . client_id = '<STR_LIT>' <EOL> self . smart_email_id = '<STR_LIT>' <EOL> self . message_id = '<STR_LIT>' <EOL> self . before_id = '<STR_LIT>' <EOL> self . after_id = '<STR_LIT>' <EOL> self . tx = Transactional ( <EOL> { '<STR_LIT>' : '<STR_LIT>' } , "<STR_LIT>" ) </s>
