From 80f11c95d09a3538a6d67e6a01152fac7d2b6893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20J=C4=99drzejewski?= Date: Wed, 12 Mar 2014 20:10:07 +0100 Subject: [PATCH] Add tests for adding interval setting automatically --- tests/test_core_modules.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/test_core_modules.py diff --git a/tests/test_core_modules.py b/tests/test_core_modules.py new file mode 100644 index 0000000..47d3cf5 --- /dev/null +++ b/tests/test_core_modules.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import unittest + +from i3pystatus.core.modules import IntervalModule + + +class IntervalModuleMetaTest(unittest.TestCase): + + def test_no_settings(self): + class NoSettings(IntervalModule): + pass + self.assertEqual(NoSettings.settings, ('interval',)) + + def test_no_interval_setting(self): + class NoIntervalSetting(IntervalModule): + settings = (('option', 'desc'),) + self.assertEqual(NoIntervalSetting.settings, + (('option', 'desc'), 'interval')) + + def test_settings_with_interval(self): + class SettingsInteval(IntervalModule): + settings = ('option', 'interval') + self.assertEqual(SettingsInteval.settings, ('option', 'interval')) + + def test_settings_with_interval_desc(self): + class SetttingsIntervalDesc(IntervalModule): + settings = (('interval', 'desc'),) + self.assertEqual(SetttingsIntervalDesc.settings, + (('interval', 'desc'),))