示例#1
0
 def send_log(self):
     self.logger.info('Sending log file')
     try:
         sender = Sender()
         self.logger.info('Bye bye.')
         time.sleep(1)
         logutil = LogUtil()
         logutil.read_log(boxsettings.LOG_FILE)
         if sender.is_online():
             self.logger.debug('sender.is_online')
             sender.send_log(logutil.log_text)
         else:
             self.logger.info('We do not send log as we are not online')
     except:
         msg = "problem occured when attempting to send the log."
         self.logger.fatal(msg)
 def btest_send_charge_level(self):
     raspi = RaspiFactory.getRaspi('Mock')
     sender = Sender()
     if sender.is_online():
         response = sender.send_battery_level(raspi.get_charge_level())
         self.assertEqual(201, response.status_code)