Exemplo n.º 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
Exemplo n.º 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_))
Exemplo n.º 3
0
 def testGetIdendifierWithUUID(self):
     hostinfo.ReadDMI = self._ReadDMIMachineUUID
     self.assertEqual(hostinfo.GetIdentifier(), 'test_uuid')
Exemplo n.º 4
0
 def testGetIdendifierWithSerial(self):
     hostinfo.ReadDMI = self._ReadDMISerial
     self.assertEqual(hostinfo.GetIdentifier(), 'test_serial')