def setUp(self): super(WebSmsGateInterfaceTest, self).setUp() bad_config = "[Provider]\n" + \ "http_username = user\n" + \ "http_password = bad_password\n" conf_parser = ConfigParser.RawConfigParser() conf_parser.readfp(io.BytesIO(bad_config)) self.overriders = {'test': 1} self.gi = WebSmsGateInterface(conf_parser) SmsLog.objects.all().delete()
def setUp(self): super(WebSmsGateInterfaceTest, self).setUp() bad_config = "[Provider]\n" + \ "http_username = user\n" + \ "http_password = bad_password\n" conf_parser = ConfigParser.RawConfigParser() conf_parser.readfp(io.BytesIO(bad_config)) self.overriders = { 'test': 1 } self.gi = WebSmsGateInterface(conf_parser) SmsLog.objects.all().delete()
class WebSmsGateInterfaceTest(BaseRestTestCase): def setUp(self): super(WebSmsGateInterfaceTest, self).setUp() bad_config = "[Provider]\n" + \ "http_username = user\n" + \ "http_password = bad_password\n" conf_parser = ConfigParser.RawConfigParser() conf_parser.readfp(io.BytesIO(bad_config)) self.overriders = {'test': 1} self.gi = WebSmsGateInterface(conf_parser) SmsLog.objects.all().delete() def test_send(self): self.assertRaises(ProviderFailure, lambda: self.gi.send(self.qi, **self.overriders)) self.assertTrue(SmsLog.objects.all().exists()) l = SmsLog.objects.get() self.assertTrue(l.text.startswith('Error sending'))
class WebSmsGateInterfaceTest(BaseRestTestCase): def setUp(self): super(WebSmsGateInterfaceTest, self).setUp() bad_config = "[Provider]\n" + \ "http_username = user\n" + \ "http_password = bad_password\n" conf_parser = ConfigParser.RawConfigParser() conf_parser.readfp(io.BytesIO(bad_config)) self.overriders = { 'test': 1 } self.gi = WebSmsGateInterface(conf_parser) SmsLog.objects.all().delete() def test_send(self): self.assertRaises(ProviderFailure, lambda: self.gi.send(self.qi, **self.overriders)) self.assertTrue(SmsLog.objects.all().exists()) l = SmsLog.objects.get() self.assertTrue(l.text.startswith('Error sending'))