def test_upgrade_show_applied_cmd(self):
        """ Test --upgrade-show-applied command. """
        self.capture()
        main("--conf-dir", "%s/etc/" % CFG_PREFIX, "--upgrade-show-applied")

        lines = self.output.getvalue().split("\n")
        self.stop_capture()

        expected = [">>> Following upgrade(s) have been applied:", ">>> No upgrades have been applied."]
        self.assertTrue(expected[0] in lines, "%s was not found in output %s" % (expected, lines))
Example #2
0
    def test_upgrade_show_applied_cmd(self):
        """ Test --upgrade-show-applied command. """
        self.capture()
        main('--conf-dir', '%s/etc/' % CFG_PREFIX, '--upgrade-show-applied')

        lines = self.output.getvalue().split('\n')
        self.stop_capture()

        expected = ['>>> Following upgrade(s) have been applied:',
                    '>>> No upgrades have been applied.']
        self.assertTrue(expected[0] in lines,
                         "%s was not found in output %s" % (expected, lines))
    def test_cmd_get(self):
        """ Test --get cmd """
        # New way of calling get
        self.capture()
        main("--conf-dir", "%s/etc/" % CFG_PREFIX, "--get=CFG_PREFIX")
        self.assertEqual("%s\n" % CFG_PREFIX, self.output.getvalue())

        # Old way of calling get
        self.capture()
        main("--conf-dir=%s/etc/" % CFG_PREFIX, "--get", "CFG_PREFIX")
        self.assertEqual("%s\n" % CFG_PREFIX, self.output.getvalue())

        # Missing option value
        self.capture()
        self.assertExitValue(2, main, "--conf-dir", "%s/etc/" % CFG_PREFIX, "--get")
        self.stop_capture()
    def test_cmd_get(self):
        """ Test --get cmd """
        # New way of calling get
        self.capture()
        main('--conf-dir', '%s/etc/' % CFG_PREFIX, '--get=CFG_PREFIX')
        self.assertEqual('%s\n' % CFG_PREFIX, self.output.getvalue())

        # Old way of calling get
        self.capture()
        main('--conf-dir=%s/etc/' % CFG_PREFIX, '--get', 'CFG_PREFIX')
        self.assertEqual("%s\n" % CFG_PREFIX, self.output.getvalue())

        # Missing option value
        self.capture()
        self.assertExitValue(2, main, '--conf-dir', "%s/etc/" % CFG_PREFIX,
                             '--get')
        self.stop_capture()