Beispiel #1
0
def check_creds(cred_req):
    """
    """
    try:
        credential_store[cred_req]
    except KeyError:
        credential_store.create(cred_req)
Beispiel #2
0
def check_creds(cred_req):
    """
    """
    try:
        credential_store[cred_req]
    except KeyError:
        credential_store.create(cred_req)
Beispiel #3
0
 def __call__(self, function):
     """
     This call is called at the detection step of the tests for py.test.
     It wil fail if the credential_requirement is not present in the store and can't be auto-detected
     Args:
         function (method, class): This is the test method or class we want to skip if the conditions aren't met
     """
     load_config_files()
     from Ganga.GPIDev.Credentials.CredentialStore import credential_store
     try:
         credential_store[self._cred_req]
         return function
     except GangaKeyError:
         try:
             credential_store.create(self._cred_req)
             return function
         except CredentialsError:
             return pytest.mark.skip(self.reason)(function)
     finally:
         clear_config()
Beispiel #4
0
    def renew(cls):
        """
        This method is similar to calling::

            credential_store.create(DiracProxy())

        or::

            credential_store[DiracProxy()].renew()

        as appropriate.
        """

        from Ganga.GPI import credential_store, DiracProxy
        try:
            cred = credential_store[DiracProxy()]
            if not cred.is_valid():
                cred.create()
        except KeyError:
            credential_store.create(DiracProxy())
Beispiel #5
0
    def renew(cls):
        """
        This method is similar to calling::

            credential_store.create(DiracProxy())

        or::

            credential_store[DiracProxy()].renew()

        as appropriate.
        """

        from Ganga.GPI import credential_store, DiracProxy
        try:
            cred = credential_store[DiracProxy()]
            if not cred.is_valid():
                cred.create()
        except KeyError:
            credential_store.create(DiracProxy())
Beispiel #6
0
 def __call__(self, function):
     """
     This call is called at the detection step of the tests for py.test.
     It wil fail if the credential_requirement is not present in the store and can't be auto-detected
     Args:
         function (method, class): This is the test method or class we want to skip if the conditions aren't met
     """
     load_config_files()
     from Ganga.GPIDev.Credentials.CredentialStore import credential_store
     try:
         credential_store[self._cred_req]
         return function
     except KeyError:
         try:
             credential_store.create(self._cred_req)
             return function
         except CredentialsError:
             return pytest.mark.skip(self.reason)(function)
     finally:
         clear_config()