コード例 #1
0
ファイル: PilotLogger.py プロジェクト: marianne013/Pilot
 def sendMessage(self,
                 messageContent,
                 source='unspecified',
                 phase='unspecified',
                 status='info'):
     """ Sends the message after
     creating the correct format:
     including content, timestamp, status, source, phase and the uuid
     of the pilot.
 Returns:
   bool: False in case of any errors, True otherwise
 """
     if not self._isCorrectStatus(status):
         logging.error('status: ' + str(status) + ' is not correct')
         return False
     myUUID = getPilotUUIDFromFile(self.params['FileWithID'])
     message = generateDict(myUUID, generateTimeStamp(), source, phase,
                            status, messageContent)
     if not isMessageFormatCorrect(message):
         logging.warning("Message format is not correct.")
         return False
     encodedMsg = encodeMessage(message)
     self.messageSender.sendMessage(encodedMsg, flag=status)
     return False
コード例 #2
0
 def test_cosistency( self ):
   result = decodeMessage( encodeMessage( self.msg ) )
   self.assertEqual( result, self.msg )
コード例 #3
0
 def test_cosistency( self ):
   result = decodeMessage( encodeMessage( self.msg ) )
   self.assertEqual( result, self.msg )
コード例 #4
0
  def test_success( self ):
    result = encodeMessage( self.msg )
    standJSON = json.dumps( self.msg )

    self.assertEqual( result, standJSON )
コード例 #5
0
  def test_success( self ):
    result = encodeMessage( self.msg )
    standJSON = json.dumps( self.msg )

    self.assertEqual( result, standJSON )