def _getId(self): """Transfer job / request / id will consist of hostname of the machine fdtcp is invoked on and timestamp. This id will be used in all requests to fdtd for tracking the state of the transfer job, esp. by MonALISA ApMon. Transfers at fdtd will be associated with this ID - make it as unique as possible to avoid collisions. """ h = getHostName() u = getUserName() dt = getDateTime() r = getRandomString('a', 'z', 5) id = "fdtcp-%s-%s-%s-%s" % (h, u, dt, r) return id
def testGetUserName(): user = getUserName() assert os.environ["LOGNAME"] == user assert isinstance(user, str)