def testPermissionFallbackCode(self):
        # test to make sure that old calls are used for manipulating
        # permissions in old repositories
        m = (('addRole', 'addAccessGroup'),
             ('addEntitlementClass', 'addEntitlementGroup'),
             ('addEntitlementClassOwner', 'addEntitlementOwnerAcl'),
             ('addEntitlementKeys', 'addEntitlements'),
             ('deleteRole', 'deleteAccessGroup'),
             ('deleteEntitlementClass', 'deleteEntitlementGroup'),
             ('deleteEntitlementClassOwner', 'deleteEntitlementOwnerAcl'),
             ('deleteEntitlementKeys', 'deleteEntitlements'),
             ('getEntitlementClassesRoles', 'getEntitlementClassAccessGroup'),
             ('getRoles', 'getUserGroups'),
             ('listRoles', 'listAccessGroups'),
             ('listEntitlementClasses', 'listEntitlementGroups'),
             ('listEntitlementKeys', 'listEntitlements'),
             ('setEntitlementClassesRoles', 'setEntitlementClassAccessGroup'),
             ('setRoleCanMirror', 'setUserGroupCanMirror'),
             ('setRoleIsAdmin', 'setUserGroupIsAdmin'),
             ('updateRoleMembers', 'updateAccessGroupMembers'))

        class MockServerProxy:
            def __init__(self):
                self.methodCalled = None

            def getProtocolVersion(self):
                return 59

            def __getattr__(self, attr):
                self.methodCalled = attr
                def f(*args, **kw):
                    return []
                return f

        empty = conarycfg.ConaryConfiguration(False)
        repos = netclient.NetworkRepositoryClient(cfg=empty)
        server = MockServerProxy()
        repos.c = { 'localhost': server }
        for method, serverMethod in m:
            f = getattr(repos, method)
            # build up an argument list, starting with 'localhost'
            # (as these methods take a server name for the first argument)
            # then filling in the rest with empty lists.  Knock 2 off the
            # argument count for self and the server name.
            args = ('localhost',) + ([],) * (f.func_code.co_argcount - 2)
            f(*args)
            # make sure that the old method would have been called
            self.assertEqual(server.methodCalled, serverMethod)
dataset/ETHPy150Open sassoftware/conary/conary_test/repositorytest/netclienttest.py/ServerProxyTest.testPermissionFallbackCode/original