示例#1
0
    def GetStamp(self):
        """Generates the "stamp" metadata to upload.

    This contains information such as when the script is run, and the host's ID.

    Returns:
      BaseStamp: the content of the stamp.
    """

        stamp = BaseStamp(
            identifier=hostinfo.GetIdentifier(),
            start_time=hostinfo.GetTime(),
        )

        return stamp
示例#2
0
 def testGetIdendifierWithRandomUUID(self):
     hostinfo.ReadDMI = self._ReadDMIRandom
     uuid_ = uuid.uuid4()
     with mock.patch('uuid.uuid4', lambda: uuid_):
         self.assertEqual(hostinfo.GetIdentifier(), str(uuid_))
示例#3
0
 def testGetIdendifierWithUUID(self):
     hostinfo.ReadDMI = self._ReadDMIMachineUUID
     self.assertEqual(hostinfo.GetIdentifier(), 'test_uuid')
示例#4
0
 def testGetIdendifierWithSerial(self):
     hostinfo.ReadDMI = self._ReadDMISerial
     self.assertEqual(hostinfo.GetIdentifier(), 'test_serial')