예제 #1
0
    def test_css_template(self):
        """> Test substitutions in template file (css)."""
        tmp_file = os.path.join(TMP_DIR, "test.css")
        export.color(COLORS, "css", tmp_file)

        self.is_file(tmp_file)
        self.is_file_contents(tmp_file, "    --background: #1F211E;")
예제 #2
0
    def test_invalid_template(self):
        """> Test template validation."""
        error_msg = "[!] warning: template 'dummy' doesn't exist."

        # Since this function prints a message on fail we redirect
        # it's output so that we can read it.
        with unittest.mock.patch('sys.stdout', new=io.StringIO()) as fake_out:
            export.color(COLORS, "dummy", OUTPUT_DIR / "test.css")
            self.assertEqual(fake_out.getvalue().strip(), error_msg)
예제 #3
0
    def test_css_template(self):
        """> Test substitutions in template file (css)."""
        export.color(COLORS, "css", OUTPUT_DIR / "test.css")

        result = pathlib.Path("/tmp/wal/test.css").is_file()
        self.assertTrue(result)

        content = pathlib.Path("/tmp/wal/test.css").read_text()
        content = content.split("\n")[6]
        self.assertEqual(content, "    --background: #1F211E;")