コード例 #1
0
def test_encoded():
    v = DiracProxy()
    assert v.encoded() == 'some_group'

    v = DiracProxy(group='foo')
    assert v.encoded() == 'foo'

    a = AfsToken()
    assert a.encoded() == ''
コード例 #2
0
def test_encoded():
    v = VomsProxy()
    assert v.encoded() == ''

    v = VomsProxy(vo='foo', group='bar')
    assert v.encoded() == 'foo:bar'

    a = AfsToken()
    assert a.encoded() == ''
コード例 #3
0
def test_eq():
    v1 = VomsProxy()
    v2 = VomsProxy()
    assert v1 == v2

    v2 = VomsProxy(vo='foo', group='bar')
    assert v1 != v2

    a1 = AfsToken()
    a2 = AfsToken()
    assert a1 == a2

    assert v1 != a1
コード例 #4
0
def test_hash():
    v1 = VomsProxy()
    v2 = VomsProxy()
    assert hash(v1) == hash(v2)

    v2 = VomsProxy(vo='foo', group='bar')
    assert hash(v1) != hash(v2)

    a1 = AfsToken()
    a2 = AfsToken()
    assert hash(a1) == hash(a2)

    assert hash(v1) != hash(a1)
コード例 #5
0
def test_eq():
    v1 = DiracProxy()
    v2 = DiracProxy()
    assert v1 == v2

    v2 = DiracProxy(group='bar')
    assert v1 != v2

    a1 = AfsToken()
    a2 = AfsToken()
    assert a1 == a2

    assert v1 != a1
コード例 #6
0
def test_hash():
    v1 = DiracProxy()
    v2 = DiracProxy()
    assert hash(v1) == hash(v2)

    v2 = DiracProxy(group='bar')
    assert hash(v1) != hash(v2)

    a1 = AfsToken()
    a2 = AfsToken()
    assert hash(a1) == hash(a2)

    assert hash(v1) != hash(a1)
コード例 #7
0
def enableInternalServices():
    """
    activates the internal services previously disabled due to expired credentials
    """
    global servicesEnabled

    if servicesEnabled:
        log.error("Cannot (re)enable services, they're already running")
        from Ganga.Core.exceptions import GangaException
        raise GangaException("Cannot (re)enable services")

    # startup the registries
    from Ganga.Runtime import Repository_runtime
    Repository_runtime.bootstrap()

    # make sure all required credentials are valid
    invalid_afs = [
        afsToken
        for afsToken in credential_store.get_all_matching_type(AfsToken())
        if not afsToken.is_valid()
    ]

    if invalid_afs:
        log.error(
            'No valid AFS token was found. Please re-authorise before reactivating this session.'
        )
        return

    log.debug("Enabling the internal services")
    # re-enable the monitoring loop as it's been explicityly requested here
    enableMonitoringService()

    servicesEnabled = True
    log.info('Internal services reactivated successfuly')
コード例 #8
0
def test_str():
    v = DiracProxy()
    assert str(v).startswith('DiracProxy(')

    a = AfsToken()
    assert str(a) == 'AfsToken()'

    v = DiracProxy(group='foo')
    assert str(v).startswith('DiracProxy(')
    assert "group='foo'" in str(v)
コード例 #9
0
def test_repr():
    v = VomsProxy()
    assert repr(v) == 'VomsProxy()'
    assert eval(repr(v)) == v

    a = AfsToken()
    assert repr(a) == 'AfsToken()'
    assert eval(repr(a)) == a

    v = VomsProxy(vo='foo', group='bar')
    assert eval(repr(v)) == v
コード例 #10
0
def test_str():
    v = VomsProxy()
    assert str(v) == 'VomsProxy()'

    a = AfsToken()
    assert str(a) == 'AfsToken()'

    v = VomsProxy(vo='foo', group='bar')
    assert str(v).startswith('VomsProxy(')
    assert "vo='foo'" in str(v)
    assert "group='bar'" in str(v)
コード例 #11
0
def test_repr():
    v = DiracProxy()
    assert repr(v).startswith('DiracProxy(')
    assert eval(repr(v)) == v

    a = AfsToken()
    assert repr(a) == 'AfsToken()'
    assert eval(repr(a)) == a

    v = DiracProxy(group='foo')
    assert eval(repr(v)) == v
コード例 #12
0
def test_plain_construct(fake_shell):
    VomsProxyInfo(VomsProxy())
    AfsTokenInfo(AfsToken())