Пример #1
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')
Пример #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)
Пример #7
0
 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)
Пример #9
0
 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)