当前位置: 首页>>代码示例>>Python>>正文


Python Proxy.destroy方法代码示例

本文整理汇总了Python中WMCore.Credential.Proxy.Proxy.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python Proxy.destroy方法的具体用法?Python Proxy.destroy怎么用?Python Proxy.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WMCore.Credential.Proxy.Proxy的用法示例。


在下文中一共展示了Proxy.destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Proxy

# 需要导入模块: from WMCore.Credential.Proxy import Proxy [as 别名]
# 或者: from WMCore.Credential.Proxy.Proxy import destroy [as 别名]
class Proxy(object):
    '''
    CMS uses proxies constantly. This class is a wrapper function around WMCore
    proxy handling, to allow the user to update/check/delete their proxy in
    myproxy and update/check the local proxy
    '''


    def __init__(self):
        '''
        Constructor
        '''
        self.helper = WMCoreProxy({'logger' : logging})

    def getProxyFilename(self):
        return self.helper.getProxyFilename()
            
    def initProxy(self):
        self.helper.create()
        
    def deleteProxy(self):
        self.helper.destroy()
    
    def uploadToMyproxy(self, allowedDN):
        self.helper.serverDN = allowedDN
        self.helper.delegate( None, True )
开发者ID:PerilousApricot,项目名称:CMSYAAT,代码行数:28,代码来源:Proxy.py

示例2: ProxyTest

# 需要导入模块: from WMCore.Credential.Proxy import Proxy [as 别名]
# 或者: from WMCore.Credential.Proxy.Proxy import destroy [as 别名]

#.........这里部分代码省略.........
    def testAAACreateProxy(self):
        """
        Test if create method creates correctly the proxy.
        This is sort of bad form to require that this test run first, but the alternative is
        entering a password for every single invocation
        """
        self.proxy.create()
        time.sleep(5)
        proxyPath = self.proxy.getProxyFilename()
        self.assertTrue(os.path.exists(proxyPath))

    @attr("integration")
    def testCheckProxyTimeLeft(self):
        """
        Test if getTimeLeft method returns correctly the proxy time left.
        """
        timeLeft = self.proxy.getTimeLeft()
        self.assertEqual(int(timeLeft) / 3600, 191)

    @attr("integration")
    def testRenewProxy(self):
        """
        Test if the renew method renews correctly the user proxy.
        """
        time.sleep(70)
        self.proxy.renew()
        time.sleep(10)
        timeLeft = self.proxy.getTimeLeft()
        self.assertEqual(int(timeLeft) / 3600, 191)

    @attr("integration")
    def testDestroyProxy(self):
        """
        Test the proxy destroy method.
        """
        self.proxy.destroy()
        self.proxyPath = self.proxy.getProxyFilename()
        self.assertFalse(os.path.exists(self.proxyPath))
        # Create the proxy after the destroy
        self.proxy.create()

    @attr("integration")
    def testGetSubject(self):
        """
        _testGetSubject_
        Verify that the getSubject() method works correctly.
        """
        subject = self.proxy.getSubject()
        self.assertEqual(subject, self.getUserIdentity(), "Error: Wrong subject.")
        return

    @attr("integration")
    def testGetUserName(self):
        """
        _testGetUserName_
        Verify that the getUserName() method correctly determines the user's
        name.
        """
        user = self.proxy.getUserName()
        identity = self.getUserIdentity().split("/")[len(self.getUserIdentity().split("/")) - 1][3:]
        self.assertEqual(user, identity, "Error: User name is wrong: |%s|\n|%s|" % (user, identity))
        return

    @attr("integration")
    def testCheckAttribute(self):
        """
开发者ID:vlimant,项目名称:WMCore,代码行数:70,代码来源:Proxy_t.py

示例3: ProxyTest

# 需要导入模块: from WMCore.Credential.Proxy import Proxy [as 别名]
# 或者: from WMCore.Credential.Proxy.Proxy import destroy [as 别名]

#.........这里部分代码省略.........
    def testAAACreateProxy( self ):
        """
        Test if create method creates correctly the proxy.
        This is sort of bad form to require that this test run first, but the alternative is
        entering a password for every single invocation
        """
        self.proxy.create()
        time.sleep( 5 )
        proxyPath = self.proxy.getProxyFilename()
        self.assertTrue(os.path.exists(proxyPath))

    @attr("integration")
    def testCheckProxyTimeLeft( self ):
        """
        Test if getTimeLeft method returns correctly the proxy time left.
        """
        timeLeft = self.proxy.getTimeLeft()
        self.assertEqual(int(timeLeft) / 3600, 191)

    @attr("integration")
    def testRenewProxy( self ):
        """
        Test if the renew method renews correctly the user proxy.
        """
        time.sleep( 70 )
        self.proxy.renew()
        time.sleep( 10 )
        timeLeft = self.proxy.getTimeLeft()
        self.assertEqual(int(timeLeft) / 3600, 191)

    @attr("integration")
    def testDestroyProxy(self ):
        """
        Test the proxy destroy method.
        """
        self.proxy.destroy( )
        self.proxyPath = self.proxy.getProxyFilename()
        self.assertFalse(os.path.exists(self.proxyPath))
        # Create the proxy after the destroy
        self.proxy.create()

    @attr("integration")
    def testGetSubject(self):
        """
        _testGetSubject_
        Verify that the getSubject() method works correctly.
        """
        subject = self.proxy.getSubject( )
        self.assertEqual(subject, self.getUserIdentity(),
                         "Error: Wrong subject.")
        return

    @attr("integration")
    def testGetUserName( self ):
        """
        _testGetUserName_
        Verify that the getUserName() method correctly determines the user's
        name.
        """
        user = self.proxy.getUserName( )
        identity = self.getUserIdentity().split("/")[ len(self.getUserIdentity().split("/")) - 1 ][3:]
        self.assertEqual(user, identity,
                         "Error: User name is wrong: |%s|\n|%s|" % (user, identity))
        return

    @attr("integration")
开发者ID:AndresTanasijczuk,项目名称:WMCore,代码行数:70,代码来源:Proxy_t.py


注:本文中的WMCore.Credential.Proxy.Proxy.destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。