def test_utf8_sha1(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_text(u'àбрвалг')
     c.set_request_keys('T')
     h = c._get_request_sha1_string('T', {
         'sms_text': u'àбрвалг'
     })
     self.assertEqual(h, 'c611522535baf80debd3f24bafa434d14fb21d9d')
示例#2
0
 def test_should_set_user_login(self):
     c = SMS('user-login', 'api-key')
     self.assertEqual(c.user_login, 'user-login')
     c.set_user_login('ul')
     self.assertEqual(c.user_login, 'ul')
示例#3
0
 def test_new(self):
     c = SMS('user-login', 'api-key')
     self.assertEqual(c.user_login, 'user-login')
     self.assertEqual(c.api_key, 'api-key')
示例#4
0
 def test_should_set_finished(self):
     c = SMS('user-login', 'api-key')
     c.set_finished('test')
     self.assertEqual(c.finished, 'test')
示例#5
0
 def test_should_set_request_keys(self):
     c = SMS('user-login', 'api-key')
     c.set_request_keys('test')
     self.assertEqual(c.request_keys, 'test')
示例#6
0
 def test_should_set_transactional(self):
     c = SMS('user-login', 'api-key')
     c.set_option_transactional(1)
     self.assertEqual(c.transactional, 1)
 def test_should_set_transactional(self):
     c = SMS('user-login', 'api-key')
     c.set_option_transactional(1)
     self.assertEqual(c.transactional, 1)
示例#8
0
 def test_should_set_request_mode(self):
     c = SMS('user-login', 'api-key')
     self.assertEqual(c.request_mode, octopush.REEL)
     c.set_simulation_mode()
     self.assertEqual(c.request_mode, octopush.SIMULATION)
 def test_should_set_finished(self):
     c = SMS('user-login', 'api-key')
     c.set_finished('test')
     self.assertEqual(c.finished, 'test')
示例#10
0
 def test_should_set_action(self):
     c = SMS('user-login', 'api-key')
     c.set_action('test')
     self.assertEqual(c.action, 'test')
示例#11
0
 def test_should_set_user_batch_id(self):
     c = SMS('user-login', 'api-key')
     c.set_user_batch_id('12abcdefgh34!.')
     self.assertEqual(c.user_batch_id, '12abcdefgh34')
示例#12
0
 def test_should_set_request_keys(self):
     c = SMS('user-login', 'api-key')
     c.set_request_keys('test')
     self.assertEqual(c.request_keys, 'test')
示例#13
0
 def test_should_set_msisdn_sender(self):
     c = SMS('user-login', 'api-key')
     c.set_sender_is_msisdn('test')
     self.assertEqual(c.msisdn_sender, 'test')
示例#14
0
 def test_should_set_recipients_last_names(self):
     c = SMS('user-login', 'api-key')
     c.set_recipients_last_names('test')
     self.assertEqual(c.recipients_last_names, 'test')
示例#15
0
 def test_should_set_user_login(self):
     c = SMS('user-login', 'api-key')
     self.assertEqual(c.user_login, 'user-login')
     c.set_user_login('ul')
     self.assertEqual(c.user_login, 'ul')
示例#16
0
 def test_should_set_sms_sender(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_sender('test')
     self.assertEqual(c.sms_sender, 'test')
示例#17
0
 def test_should_set_api_key(self):
     c = SMS('user-login', 'api-key')
     self.assertEqual(c.api_key, 'api-key')
     c.set_api_key('ak')
     self.assertEqual(c.api_key, 'ak')
示例#18
0
 def test_should_set_request_id(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_request_id('12abcdefgh34!.')
     self.assertEqual(c.request_id, '12abcdefgh34')
示例#19
0
 def test_should_set_recipients_last_names(self):
     c = SMS('user-login', 'api-key')
     c.set_recipients_last_names('test')
     self.assertEqual(c.recipients_last_names, 'test')
示例#20
0
    def test_get_credit(self):
        if os.environ.get('OCTOPUSH_USER_LOGIN') is not None and os.environ.get('OCTOPUSH_API_KEY') is not None:
            c = SMS(os.environ.get('OCTOPUSH_USER_LOGIN'), os.environ.get('OCTOPUSH_API_KEY'))
            r = c.get_credit()

            self.assertEqual(len(r.findall('credit')), 1)
示例#21
0
 def test_should_set_sms_fields_3(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_fields_3('test')
     self.assertEqual(c.sms_fields_3, 'test')
示例#22
0
 def test_should_set_msisdn_sender(self):
     c = SMS('user-login', 'api-key')
     c.set_sender_is_msisdn('test')
     self.assertEqual(c.msisdn_sender, 'test')
示例#23
0
 def test_should_set_sms_sender(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_sender('test')
     self.assertEqual(c.sms_sender, 'test')
示例#24
0
 def test_should_set_user_batch_id(self):
     c = SMS('user-login', 'api-key')
     c.set_user_batch_id('12abcdefgh34!.')
     self.assertEqual(c.user_batch_id, '12abcdefgh34')
示例#25
0
 def test_should_set_sms_date(self):
     c = SMS('user-login', 'api-key')
     c.set_time(2000, 1, 1, 0, 0)
     self.assertEqual(c.sending_time, int(time.mktime(datetime.datetime(2000, 1, 1, 0, 0).timetuple())))
示例#26
0
 def test_should_set_action(self):
     c = SMS('user-login', 'api-key')
     c.set_action('test')
     self.assertEqual(c.action, 'test')
示例#27
0
 def test_should_set_request_mode(self):
     c = SMS('user-login', 'api-key')
     self.assertEqual(c.request_mode, octopush.REEL)
     c.set_simulation_mode()
     self.assertEqual(c.request_mode, octopush.SIMULATION)
示例#28
0
 def test_utf8_sha1(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_text(u'àбрвалг')
     c.set_request_keys('T')
     h = c._get_request_sha1_string('T', {'sms_text': u'àбрвалг'})
     self.assertEqual(h, 'c611522535baf80debd3f24bafa434d14fb21d9d')
示例#29
0
 def test_should_set_sms_ticket(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_ticket('test')
     self.assertEqual(c.sms_ticket, 'test')
示例#30
0
 def test_should_set_api_key(self):
     c = SMS('user-login', 'api-key')
     self.assertEqual(c.api_key, 'api-key')
     c.set_api_key('ak')
     self.assertEqual(c.api_key, 'ak')
示例#31
0
 def test_should_set_request_id(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_request_id('12abcdefgh34!.')
     self.assertEqual(c.request_id, '12abcdefgh34')
示例#32
0
 def test_should_set_sms_fields_3(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_fields_3('test')
     self.assertEqual(c.sms_fields_3, 'test')
示例#33
0
 def test_should_set_with_replies(self):
     c = SMS('user-login', 'api-key')
     c.set_option_with_replies(1)
     self.assertEqual(c.with_replies, 1)
示例#34
0
 def test_should_set_sms_date(self):
     c = SMS('user-login', 'api-key')
     c.set_time(2000, 1, 1, 0, 0)
     self.assertEqual(
         c.sending_time,
         int(time.mktime(datetime.datetime(2000, 1, 1, 0, 0).timetuple())))
示例#35
0
from octopush import SMS
from config import config

sms = SMS(config["user_login"], config["api_key"])

result = sms.get_credit()

for credit in result.findall("credit"):
    print(credit.text)
示例#36
0
 def test_should_set_sms_ticket(self):
     c = SMS('user-login', 'api-key')
     c.set_sms_ticket('test')
     self.assertEqual(c.sms_ticket, 'test')
示例#37
0
from octopush import SMS
from config import config

sms = SMS(config['user_login'], config['api_key'])

result = sms.get_credit()

for credit in result.findall('credit'):
    print(credit.text)
示例#38
0
 def test_should_set_with_replies(self):
     c = SMS('user-login', 'api-key')
     c.set_option_with_replies(1)
     self.assertEqual(c.with_replies, 1)
示例#39
0
    def test_get_credit(self):
        if os.environ.get("OCTOPUSH_USER_LOGIN") is not None and os.environ.get("OCTOPUSH_API_KEY") is not None:
            c = SMS(os.environ.get("OCTOPUSH_USER_LOGIN"), os.environ.get("OCTOPUSH_API_KEY"))
            r = c.get_credit()

            self.assertEqual(len(r.findall("credit")), 1)