def test_is_valid(fake_shell): req = DiracProxy(group='some_group') v = DiracProxyInfo(req) assert v.is_valid() fake_shell.timeleft = 0 assert not v.is_valid()
def test_create(fake_shell): req = DiracProxy(group='some_group') v = DiracProxyInfo(req) v.create() assert v.shell.check_call.call_count == 1 cmd = v.shell.check_call.call_args[0][0] assert 'dirac-proxy-init' in cmd assert '-group some_group' in cmd assert '-out "{0}"'.format(v.location) in cmd
def diracLFNBase(): """ Compute a sensible default LFN base name If ``DiracLFNBase`` has been defined, use that. Otherwise, construct one from the user name and the user VO """ if configDirac['DiracLFNBase']: return configDirac['DiracLFNBase'] return '/{0}/user/{1}/{2}'.format(configDirac['userVO'], DiracProxyInfo(DiracProxy()).username[0], DiracProxyInfo(DiracProxy()).username)
def diracLFNBase(credential_requirements): """ Compute a sensible default LFN base name If ``DiracLFNBase`` has been defined, use that. Otherwise, construct one from the user name and the user VO """ if configDirac['DiracLFNBase']: return configDirac['DiracLFNBase'] user = DiracProxyInfo(credential_requirements).username return '/{0}/user/{1}/{2}'.format(configDirac['userVO'], user[0], user)
def test_location(fake_shell): req = DiracProxy(group='some_group') v = DiracProxyInfo(req) assert v.location == v.default_location()
def test_default_location(fake_shell): v = DiracProxyInfo(DiracProxy()) assert v.location == v.default_location()
def test_construct(fake_shell): req = DiracProxy(group='some_group') DiracProxyInfo(req)
def test_plain_construct(fake_shell): DiracProxyInfo(DiracProxy())