class TestNotificationFilesCreatedForSMSServerToolsModem(TestCase): def setUp(self): self.path = tempfile.mkdtemp('smve-outoging-sms') self.modem = SMSServerToolsModem(outoging_queue=self.path) self.modem.get_current_time_formated = mock.MagicMock() self.fixed_date = '20120101235959' self.modem.get_current_time_formated.return_value = self.fixed_date def test_sms_created_for_sms_server_tools_without_id(self): to = 5492804123456 message = 'Esta es una prueba' self.modem.send_sms(to, message) expedted_file_path = os.path.join( self.path, self.fixed_date + '-' + str(to) + '-' + 'NA' ) assert os.path.exists(expedted_file_path) with open(expedted_file_path) as fp: data = fp.read() import pdb; pdb.set_trace() os.unlink(expedted_file_path) def test_sms_created_for_sms_server_tools_with_id(self): to = 5492804123456 msg_id = 1234 message = 'Esta es una prueba' self.modem.send_sms(to, message, msg_id) expedted_file_path = os.path.join( self.path, self.fixed_date + '-' + str(to) + '-' + str(msg_id) ) assert os.path.exists(expedted_file_path) os.unlink(expedted_file_path) def tearDown(self): shutil.rmtree(self.path, ignore_errors=True) def test_create_message_file(self): NotificationRequest.objects.all().delete() with self.settings(): pass
def setUp(self): self.path = tempfile.mkdtemp('smve-outoging-sms') self.modem = SMSServerToolsModem(outoging_queue=self.path) self.modem.get_current_time_formated = mock.MagicMock() self.fixed_date = '20120101235959' self.modem.get_current_time_formated.return_value = self.fixed_date