Beispiel #1
0
    def test_send_notification(self):
        config.twilio_account = 'account'
        config.twilio_token = 'token'
        config.twilio_sender_number = 'send'
        config.twilio_recipient_number = 'receive'

        twilio = TwilioSMSNotification()

        twilio.twilio_client.messages.create = MagicMock()

        twilio.send_notification('test message')

        twilio.twilio_client.messages.create.assert_called_with(
                body='test message', to='receive', from_='send')
Beispiel #2
0
    def test_send_notification(self):
        config.twilio_account = 'account'
        config.twilio_token = 'token'
        config.twilio_sender_number = 'send'
        config.twilio_recipient_number = 'receive'

        twilio = TwilioSMSNotification()

        twilio.twilio_client.messages.create = MagicMock()

        twilio.send_notification('test message')

        twilio.twilio_client.messages.create.assert_called_with(
            body='test message', to='receive', from_='send')
Beispiel #3
0
import os
import sys
os.chdir('..')
sys.path.append('.')
from piot.notification import TwilioSMSNotification
from twilio import TwilioRestException

print('==================')
print('Twilio Test Script')
print('==================')

while True:
    twilio_notification = TwilioSMSNotification()

    try:
        twilio_notification.send_notification('Test Notification from PIoT')
    except TwilioRestException:
        print('Twilio Exception - Check Connectivity and Settings')
        print('Test Failed')
        exit(1)

    print('SMS Send')

    print('Did you receieve an SMS [Yes/No]')
    result = input()

    if result.lower() == 'yes':
        print('Test Passed')
        exit(0)
    elif result.lower() == 'no':
        print('Test Failed')
Beispiel #4
0
import os
import sys
os.chdir('..')
sys.path.append('.')
from piot.notification import TwilioSMSNotification
from twilio import TwilioRestException 

print('==================')
print('Twilio Test Script')
print('==================')

while True:
    twilio_notification=TwilioSMSNotification()
    
    try:
        twilio_notification.send_notification('Test Notification from PIoT')
    except TwilioRestException:
        print('Twilio Exception - Check Connectivity and Settings')
        print('Test Failed')
        exit(1)
    
    print('SMS Send')
    
    print('Did you receieve an SMS [Yes/No]')
    result=input()
    
    if result.lower()=='yes':
        print('Test Passed')
        exit(0)
    elif result.lower()=='no':
        print('Test Failed')