Ejemplo n.º 1
0
    def runCommand(self,
                   cfg,
                   argSet,
                   args,
                   profile=False,
                   callback=None,
                   repos=None):
        args = args[1:]
        if len(args) > 2:
            return self.usage()

        showPasswords = argSet.pop('show-passwords', False)
        ask = argSet.pop('ask', False)
        if len(args) > 1:
            name = args[1]
        else:
            name = None

        try:
            prettyPrint = sys.stdout.isatty()
        except AttributeError:
            prettyPrint = False
        cfg.setDisplayOptions(hidePasswords=not showPasswords,
                              prettyPrint=prettyPrint)
        checkin.setContext(cfg, name, ask=ask, repos=repos)
Ejemplo n.º 2
0
    def runCommand(self, cfg, argSet, args, profile = False,
                   callback = None, repos = None):
        args = args[1:]
        if len(args) > 2:
            return self.usage()

        showPasswords = argSet.pop('show-passwords', False)
        ask = argSet.pop('ask', False)
        if len(args) > 1:
            name = args[1]
        else:
            name = None

        try:
            prettyPrint = sys.stdout.isatty()
        except AttributeError:
            prettyPrint = False
        cfg.setDisplayOptions(hidePasswords=not showPasswords,
                              prettyPrint=prettyPrint)
        checkin.setContext(cfg, name, ask=ask, repos=repos)
Ejemplo n.º 3
0
    def testGetClient(self):
        self.cfg.configLine('[1]')
        self.cfg.contact = 'foo'
        cfg = copy.deepcopy(self.cfg)
        client = conaryclient.getClient(context='1', cfg=cfg)
        assert(client.cfg.context == '1')
        assert(client.cfg.contact == 'foo')
        cfg = copy.deepcopy(self.cfg)
        client = conaryclient.getClient(environ={'CONARY_CONTEXT' : '1'}, 
                                        cfg=cfg)
        assert(client.cfg.context == '1')
        assert(client.cfg.contact == 'foo')
        os.chdir(self.workDir)
        checkin.setContext(self.cfg, '1')
        cfg = copy.deepcopy(self.cfg)
        client = conaryclient.getClient(cfg=cfg)
        assert(not client.cfg.context)
        client = conaryclient.getClient(cfg=cfg, searchCurrentDir=True)

        assert(client.cfg.context == '1')
        assert(client.cfg.contact == 'foo')