示例#1
0
    def test_send_mobile_number(self, mock_request):
        resp_mock = MagicMock()
        resp_mock.json.return_value = {
            'data': {
                'id': 16829892,
                'sms': 1
            },
            'message': 'Mensaje enviado.',
            'code': 200
        }

        mock_request.get.return_value = resp_mock
        sms = SMSC(alias='test', apikey='test')
        resp = sms.send(area_code='011',
                        local_number='1531268974',
                        msg='testing')
        assert mock_request.get.called
        assert resp == {
            'data': {
                'id': 16829892,
                'sms': 1
            },
            'message': 'Mensaje enviado.',
            'code': 200
        }
示例#2
0
def test_client():
    assert os.environ.get('SMSC_LOGIN')
    assert os.environ.get('SMSC_PASSWORD')
    client2 = SMSC(login=os.environ['SMSC_LOGIN'],
                   password=os.environ['SMSC_PASSWORD'],
                   sender=os.environ.get('SMSC_SENDER', None))
    assert str(client2) == "<SMSC login='******' sender='%s'>" % (
        os.environ['SMSC_LOGIN'], os.environ.get('SMSC_SENDER', None))
示例#3
0
def client():
    return SMSC(login=os.environ['SMSC_LOGIN'],
                password=os.environ['SMSC_PASSWORD'],
                sender=os.environ.get('SMSC_SENDER', None))