/
t.py
53 lines (40 loc) · 1.54 KB
/
t.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from uowmlib import WPCollection, WPConfiguration
from uowmbackends import WPBackendGsettings
import unittest
from shell import shell
class TesCollection(unittest.TestCase):
def setUp(self):
self.col = WPCollection([])
def test_draw(self):
winner = self.col.draw()
self.assertIn(winner, self.col.file_list)
def test_dummy(self):
self.assertEqual(1,1)
class TestGsettings(unittest.TestCase):
def setUp(self):
self.col = WPCollection([])
self.backend = WPBackendGsettings()
def test_set_wp(self):
winner = self.col.draw()
self.backend.set_wallpaper(winner)
picture_uri = shell(
"/usr/bin/env gsettings get org.gnome.desktop.background \
picture-uri").output()[0]
self.assertEqual("'file://"+winner+"'", picture_uri)
class TestConfiguration(unittest.TestCase):
def setUp(self):
self._conf = WPConfiguration("./uowmrc-example")
def test_default_dirs(self):
self.assertEqual(self._conf.default_dirs, ['/home/pedro/wallpapers'])
def test_append_default_dirs(self):
self.assertFalse(self._conf.append_default_dirs)
def test_log_file(self):
self.assertEqual(self._conf.log_file, '/home/pedro/.uowm/log')
def test_no_repeat(self):
self.assertEqual(self._conf.no_repeat, 20)
def test_cycle_dirs(self):
self.assertTrue(self._conf.cycle_dirs)
def test_backend(self):
self.assertEqual(self._conf.backend, "Noop")
if __name__ == '__main__':
unittest.main()