-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_ui_choosing.py
51 lines (41 loc) · 1.15 KB
/
test_ui_choosing.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
#!/usr/bin/python
#encoding: utf-8
""" Module testing Torrent List Controller """
from twisted.trial import unittest
# import ui
from gi.repository import Gtk #pylint: disable=E0611
from ui.videotorrent_list_control import VideoFinderController
class FakeApp(object):
""" Fake testing app """
def __init__(self):
builder = Gtk.Builder()
builder.add_from_file("../ui/IfacePlay.ui")
self.window = builder.get_object("MainWindow")
self.builder = builder
def getitem(self, key):
""" Utility function, get a widget from is string ID """
#return self.widg_tree.get_widget(key)
return self.builder.get_object(key)
def stop(self):
self.window.hide()
def create_app():
""" Fake App factory function """
return FakeApp()
class TestVideotorrentController(unittest.TestCase):
""" Controller testcase :
* create app
* empty selection
* selection
* cancelation
"""
def setUp(self): #pylint: disable=C0103
""" setting up """
self.app = None
print("setting up")
def tearDown(self):
self.app.stop()
def test_1(self):
""" Fake app creation """
self.app = create_app()
control = VideoFinderController(self.app)
return control