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
def testGetIdendifierWithRandomUUID(self): hostinfo.ReadDMI = self._ReadDMIRandom uuid_ = uuid.uuid4() with mock.patch('uuid.uuid4', lambda: uuid_): self.assertEqual(hostinfo.GetIdentifier(), str(uuid_))
def testGetIdendifierWithUUID(self): hostinfo.ReadDMI = self._ReadDMIMachineUUID self.assertEqual(hostinfo.GetIdentifier(), 'test_uuid')
def testGetIdendifierWithSerial(self): hostinfo.ReadDMI = self._ReadDMISerial self.assertEqual(hostinfo.GetIdentifier(), 'test_serial')