Ejemplo n.º 1
0
    def test_wal_special(self):
        with unittest.mock.patch("core.theme.io") as io:
            with unittest.mock.patch("core.theme.os") as os:
                os.path.isfile.return_value = True
                io.open.return_value.__enter__.return_value.read.return_value = """
                    { "special": { "background": "#ff0000" } }
                """

                theme = core.theme.Theme(raw_data=self.walTheme)
                self.assertEqual({"background": "#ff0000"}, theme.keywords())
Ejemplo n.º 2
0
    def test_wal_colors(self):
        with unittest.mock.patch("core.theme.io") as io:
            with unittest.mock.patch("core.theme.os") as os:
                os.path.isfile.return_value = True
                io.open.return_value = unittest.mock.MagicMock()
                io.open.return_value.__enter__.return_value.read.return_value = """
                    { "colors": { "red": "#ff0000" } }
                """

                theme = core.theme.Theme(raw_data=self.walTheme)
                self.assertEqual({"red": "#ff0000"}, theme.keywords())
Ejemplo n.º 3
0
def test_wal_special(mocker, walTheme):
    io = mocker.patch("core.theme.io")
    os = mocker.patch("core.theme.os")

    os.path.isfile.return_value = True
    io.open.return_value.__enter__.return_value.read.return_value = """
        { "special": { "background": "#ff0000" } }
    """

    theme = core.theme.Theme(raw_data=walTheme)

    assert theme.keywords() == {"background": "#ff0000"}
Ejemplo n.º 4
0
def test_wal_colors(mocker, walTheme):
    io = mocker.patch("core.theme.io")
    os = mocker.patch("core.theme.os")

    os.path.isfile.return_value = True
    io.open.return_value = mocker.MagicMock()
    io.open.return_value.__enter__.return_value.read.return_value = """
        { "colors": { "red": "#ff0000" } }
    """

    theme = core.theme.Theme(raw_data=walTheme)

    assert theme.keywords() == {"red": "#ff0000"}
Ejemplo n.º 5
0
def test_colors(defaultsTheme, colorTheme):
    theme = core.theme.Theme(raw_data=defaultsTheme)
    assert theme.keywords() == {}

    theme = core.theme.Theme(raw_data=colorTheme)
    assert theme.keywords() == colorTheme["colors"][0]
Ejemplo n.º 6
0
 def test_colors(self):
     theme = core.theme.Theme(raw_data=self.defaultsTheme)
     self.assertEqual({}, theme.keywords())
     theme = core.theme.Theme(raw_data=self.colorTheme)
     self.assertEqual(self.colorTheme["colors"][0], theme.keywords())