Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 4
0
 def test_should_set_finished(self):
     c = SMS('user-login', 'api-key')
     c.set_finished('test')
     self.assertEqual(c.finished, 'test')
Ejemplo n.º 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')
Ejemplo n.º 6
0
 def test_should_set_transactional(self):
     c = SMS('user-login', 'api-key')
     c.set_option_transactional(1)
     self.assertEqual(c.transactional, 1)
Ejemplo n.º 7
0
 def test_should_set_transactional(self):
     c = SMS('user-login', 'api-key')
     c.set_option_transactional(1)
     self.assertEqual(c.transactional, 1)
Ejemplo n.º 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)
Ejemplo n.º 9
0
 def test_should_set_finished(self):
     c = SMS('user-login', 'api-key')
     c.set_finished('test')
     self.assertEqual(c.finished, 'test')
Ejemplo n.º 10
0
 def test_should_set_action(self):
     c = SMS('user-login', 'api-key')
     c.set_action('test')
     self.assertEqual(c.action, 'test')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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)
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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())))
Ejemplo n.º 26
0
 def test_should_set_action(self):
     c = SMS('user-login', 'api-key')
     c.set_action('test')
     self.assertEqual(c.action, 'test')
Ejemplo n.º 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)
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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)
Ejemplo n.º 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())))
Ejemplo n.º 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)
Ejemplo n.º 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')
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)