1
|
|
|
"""This module is to test the refresh commands plugin.""" |
2
|
|
|
|
3
|
|
|
import sys |
4
|
|
|
|
5
|
|
|
from unittest import TestCase |
6
|
|
|
|
7
|
|
|
REFRESH_COMMANDS = sys.modules["Rainmeter.refreshcommands"] |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
class TestRefreshCommandArgs(TestCase): |
11
|
|
|
"""Test class wrapper using unittest.""" |
12
|
|
|
|
13
|
|
|
# pylint: disable=W0703; This is acceptable since we are testing it not failing |
14
|
|
|
|
15
|
|
|
def test_for_more_flags(self): |
16
|
|
|
"""Calling from an inc file should result in less call flags.""" |
17
|
|
|
shorter = REFRESH_COMMANDS.calculate_refresh_commands("Rainmeter.exe", "test-config", "file.inc", True, True) |
18
|
|
|
longer = REFRESH_COMMANDS.calculate_refresh_commands("Rainmeter.exe", "test-config", "file.ini", True, False) |
19
|
|
|
|
20
|
|
|
self.assertGreater(longer, shorter) |
21
|
|
|
|
22
|
|
|
def test_for_size(self): |
23
|
|
|
"""Calling an inc file should matter only by one argument. |
24
|
|
|
|
25
|
|
|
It is missing the file name since we cannot directly refresh the inc file.""" |
26
|
|
|
|
27
|
|
|
inc = REFRESH_COMMANDS.calculate_refresh_commands("Rainmeter.exe", "test-config", "file.inc", True, True) |
28
|
|
|
ini = REFRESH_COMMANDS.calculate_refresh_commands("Rainmeter.exe", "test-config", "file.ini", True, False) |
29
|
|
|
|
30
|
|
|
self.assertEqual(len(inc) + 1, len(ini)) |
31
|
|
|
|
32
|
|
|
def test_config_overwrite(self): |
33
|
|
|
"""If the config option is not activated we force it to do nothing thus resulting in the same result.""" |
34
|
|
|
inc = REFRESH_COMMANDS.calculate_refresh_commands("Rainmeter.exe", "test-config", "file.inc", False, True) |
35
|
|
|
ini = REFRESH_COMMANDS.calculate_refresh_commands("Rainmeter.exe", "test-config", "file.ini", False, False) |
36
|
|
|
|
37
|
|
|
self.assertEquals(inc, ini) |
38
|
|
|
|