tests.py
Go to the documentation of this file.
00001 from googlevoice import Voice, util
00002 from os import path, remove
00003 from unittest import TestCase, main
00004 
00005 class VoiceTest(TestCase):
00006     voice = Voice()
00007     voice.login()
00008     outgoing = util.input('Outgoing number (blank to ignore call tests): ')
00009     forwarding = None
00010     if outgoing:
00011         forwarding = util.input('Forwarding number [optional]: ') or None
00012     
00013     if outgoing:
00014         def test_1call(self):
00015             self.voice.call(self.outgoing, self.forwarding)
00016 
00017         def test_sms(self):
00018             self.voice.send_sms(self.outgoing, 'i sms u')
00019 
00020         def test_2cancel(self):
00021             self.voice.cancel(self.outgoing, self.forwarding)
00022     
00023     def test_special(self):
00024         self.assert_(self.voice.special)
00025         
00026     def test_inbox(self):
00027         self.assert_(self.voice.inbox)
00028     
00029     def test_balance(self):
00030         self.assert_(self.voice.settings['credits'])
00031         
00032     def test_search(self):
00033         self.assert_(len(self.voice.search('joe')))
00034     
00035     def test_disable_enable(self):
00036         self.voice.phones[0].disable()
00037         self.voice.phones[0].enable()
00038     
00039     def test_download(self):
00040         msg = list(self.voice.voicemail.messages)[0]
00041         fn = '%s.mp3' % msg.id
00042         if path.isfile(fn): remove(fn)
00043         self.voice.download(msg)
00044         self.assert_(path.isfile(fn))
00045     
00046     def test_zlogout(self):
00047         self.voice.logout()
00048         self.assert_(self.voice.special is None)
00049         
00050     def test_config(self):
00051         from conf import config
00052         self.assert_(config.forwardingNumber)
00053         self.assert_(str(config.phoneType) in '1237')
00054         self.assertEqual(config.get('wtf'), None)
00055         
00056 if __name__ == '__main__': main()


continuous_ops_alerts
Author(s): Eitan Marder-Eppstein
autogenerated on Fri Dec 6 2013 19:59:13