Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")