Beispiel #1
0
 def test_config_paths(self):
     c = trtc.get_config()
     c.Co2dice.raise_config_file_errors = True
     cmd = cmdlets.chain_cmds([cfgcmd.PathsCmd], [], config=c)
     res = cmd.start()
     res = list(res)
     self.assertGreaterEqual(len(res), 2, res)
Beispiel #2
0
 def test_config_show(self):
     c = trtc.get_config()
     c.Co2dice.raise_config_file_errors = True
     cmd = cmdlets.chain_cmds([cfgcmd.ShowCmd], [], config=c)
     res = cmd.start()
     res = list(res)
     ## Count Cmd-lines not starting with '  +--trait'.
     ncmdlines = sum(1 for r in res if r[0] != ' ')
     self.assertGreaterEqual(ncmdlines, 10, res)  # I counted at least 10...
Beispiel #3
0
 def test_config_show_verbose(self):
     c = trtc.get_config()
     c.ShowCmd.verbose = 1
     c.Co2dice.raise_config_file_errors = True
     cmd = cfgcmd.ShowCmd(config=c)
     cmd.initialize([])
     res = list(cmd.run())
     ## Count Cmd-lines not starting with '  +--trait'.
     ncmdlines = sum(1 for r in res if r[0] != ' ')
     self.assertGreaterEqual(ncmdlines, len(cmd.all_app_configurables()), res)
Beispiel #4
0
 def test_config_init(self):
     c = trtc.get_config()
     c.Co2dice.raise_config_file_errors = True
     cmd = cfgcmd.WriteCmd(config=c)
     cmd.initialize([])
     with tempfile.TemporaryDirectory() as td:
         conf_fpath = osp.join(td, 'cc.py')
         cmd.run(conf_fpath)
         self.assertTrue(osp.isfile(conf_fpath),
                         (conf_fpath, os.listdir(osp.split(conf_fpath)[0])))
         stat = os.stat(conf_fpath)
         self.assertGreater(stat.st_size, 7000, stat)
Beispiel #5
0
    def setUpClass(cls):
        cls.cfg = c = trtc.get_config()

        c.GpgSpec.gnupghome = tempfile.mkdtemp(prefix='gpghome-')
        c.GpgSpec.keys_to_import = test_pgp_keys
        c.GpgSpec.trust_to_import = test_pgp_trust
        c.GpgSpec.master_key = test_pgp_fingerprint
        c.GpgSpec.allow_test_key = True
        c.DiceSpec.user_name = "Test Vase"
        c.DiceSpec.user_email = "*****@*****.**"

        crypto.GpgSpec(config=c)

        ## Clean memories from past tests
        #
        crypto.StamperAuthSpec.clear_instance()  # @UndefinedVariable
        crypto.GitAuthSpec.clear_instance()  # @UndefinedVariable
        crypto.VaultSpec.clear_instance()  # @UndefinedVariable

        cls._project_repo = tempfile.TemporaryDirectory()
        log.debug('Temp-repo: %s', cls._project_repo)
Beispiel #6
0
 def test_app(self, meth):
     c = trtc.get_config()
     c.Co2dice.raise_config_file_errors = True
     cmd = cli.Co2diceCmd(config=c)
     meth(cmd)