Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
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()
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
def test_location(fake_shell):
    req = DiracProxy(group='some_group')
    v = DiracProxyInfo(req)
    assert v.location == v.default_location()
Ejemplo n.º 8
0
def test_default_location(fake_shell):
    v = DiracProxyInfo(DiracProxy())
    assert v.location == v.default_location()
Ejemplo n.º 9
0
def test_construct(fake_shell):
    req = DiracProxy(group='some_group')
    DiracProxyInfo(req)
Ejemplo n.º 10
0
def test_plain_construct(fake_shell):
    DiracProxyInfo(DiracProxy())
Ejemplo n.º 11
0
def test_location(fake_shell):
    req = DiracProxy(group='some_group')
    v = DiracProxyInfo(req)
    assert v.location == v.default_location()
Ejemplo n.º 12
0
def test_default_location(fake_shell):
    v = DiracProxyInfo(DiracProxy())
    assert v.location == v.default_location()