示例#1
0
    def test_format_license_color(self, stdout):
        stdout.isatty.return_value = True

        good = license_info.format_license("foo", True)
        self.assertEqual(good, "\033[1m\033[32mfoo\033[0m")

        bad = license_info.format_license("bar", False)
        self.assertEqual(bad, "\033[1m\033[31mbar\033[0m")
示例#2
0
    def test_format_license_piped(self, stdout):
        stdout.isatty.return_value = False

        good = license_info.format_license("foo", True)
        self.assertEqual(good, "foo")

        bad = license_info.format_license("bar", False)
        self.assertEqual(bad, "bar")
示例#3
0
    def test_format_license_color(self, stdout):
        stdout.isatty.return_value = True

        good = license_info.format_license("foo", True)
        self.assertEqual(good, "\033[1m\033[32mfoo\033[0m")

        bad = license_info.format_license("bar", False)
        self.assertEqual(bad, "\033[1m\033[31mbar\033[0m")
示例#4
0
    def test_format_license_piped(self, stdout):
        stdout.isatty.return_value = False

        good = license_info.format_license("foo", True)
        self.assertEqual(good, "foo")

        bad = license_info.format_license("bar", False)
        self.assertEqual(bad, "bar")
示例#5
0
    def test_format_license_raw(self, stdout):
        good = license_info.format_license("qux", True)
        self.assertEqual(good, "qux")

        bad = license_info.format_license("ham", False)
        self.assertEqual(bad, "ham")
示例#6
0
    def test_format_license_raw(self, stdout):
        good = license_info.format_license("qux", True)
        self.assertEqual(good, "qux")

        bad = license_info.format_license("ham", False)
        self.assertEqual(bad, "ham")