Merge lp:~pedro/mago/transmission-gtk into lp:~mago-contributors/mago/mago-testsuite

Proposed by Pedro Villavicencio
Status: Merged
Merged at revision: 5
Proposed branch: lp:~pedro/mago/transmission-gtk
Merge into: lp:~mago-contributors/mago/mago-testsuite
Diff against target: 120 lines (+115/-0)
1 file modified
transmission-gtk/test_transmission-gtk.py (+115/-0)
To merge this branch: bzr merge lp:~pedro/mago/transmission-gtk
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Approve
Review via email: mp+46606@code.launchpad.net

Description of the change

transmission gtk test

To post a comment you must log in.
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'transmission-gtk'
=== added file 'transmission-gtk/test_transmission-gtk.py'
--- transmission-gtk/test_transmission-gtk.py 1970-01-01 00:00:00 +0000
+++ transmission-gtk/test_transmission-gtk.py 2011-01-18 14:20:11 +0000
@@ -0,0 +1,115 @@
1# Copyright (C) 2010 Canonical Ltd
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
17"""Transmission GTK Test
18
19This is a test that verifies that Transmission application is working correctly.
20So far what it does is:
21 - Add a torrent URL.
22 - Check that the torrent is being downloaded.
23 - Remove the torrent and the files downloaded.
24
25This test only requires an Internet connection to be run.
26
27To run it with:
28$ mago-ng <path_to_this_file>
29"""
30
31from mago import TestCase
32import unittest
33import ldtp
34import ooldtp
35
36TRANSMISSION = 'frmTransmission'
37DLG_INFORMATION = 'dlgInformation'
38IACCEPT = 'btnIAccept'
39MNU_ADD_URL = 'mnuAddURL'
40DLG_ADD_URL = 'dlgAddURL'
41TXT_ADD_URL = 'txtURL'
42BTN_ADD_URL = 'btnAdd'
43DLG_TORRENT_OPTIONS = 'dlgTorrentOptions'
44DLG_QUESTION = 'dlgQuestion'
45BTN_REMOVE = 'btnDelete'
46TABLE = 'tbl0'
47MNU_REMOVE_TORRENT = 'mnuDeleteFilesandRemove'
48SPEED = 'lbl*KiB/s'
49"""This is the torrent image we download
50"""
51TORRENT = 'http://cdimage.ubuntu.com/releases/maverick/release/ubuntu-10.10-dvd-i386.iso.torrent'
52
53class TransmissionsTests(TestCase):
54 """Launcher for the application transmission
55 """
56 launcher = 'transmission-gtk'
57 window_name = TRANSMISSION
58 setupOnce = True
59
60 def transmission_01_test_add_torrent(self):
61 """Test that adding a torrent works fine.
62 When you launch transmission for the first time and information dialog
63 is being displayed with information regarding torrents, we wait for
64 that dialog and accept.
65 """
66 if ldtp.guiexist(DLG_INFORMATION):
67 i = ooldtp.context(DLG_INFORMATION)
68 i.getchild(IACCEPT).click()
69
70 t = ooldtp.context(TRANSMISSION)
71 t.getchild(MNU_ADD_URL).selectmenuitem()
72
73 ldtp.waittillguiexist(DLG_ADD_URL)
74 du = ooldtp.context(DLG_ADD_URL)
75 du.getchild(TXT_ADD_URL).settextvalue(TORRENT)
76 du.getchild(BTN_ADD_URL).click()
77
78 ldtp.waittillguiexist(DLG_TORRENT_OPTIONS)
79
80 if ldtp.guiexist(DLG_TORRENT_OPTIONS):
81 to = ooldtp.context(DLG_TORRENT_OPTIONS)
82 to.getchild(BTN_ADD_URL).click()
83
84 self.assertTrue(ldtp.guiexist(TRANSMISSION))
85
86 def transmission_02_test_check_torrent(self):
87 """Test that checks that the torrent is being downloaded, we double check
88 that the treeview contains the torrent element and that the speed changes.
89 """
90 t = ooldtp.context(TRANSMISSION)
91 table = t.getchild(TABLE)
92 self.assertTrue(table.getrowcount() > 0)
93 """wait until the torrent has started to download.
94 """
95 while t.getchild(SPEED).gettextvalue() == '0.00 KiB/s':
96 ldtp.wait(2)
97
98 def transmission_03_test_remove_torrent(self):
99 """Test that removes the torrent and the files.
100 """
101 t = ooldtp.context(TRANSMISSION)
102 table = t.getchild(TABLE)
103 table.selectrowindex(0)
104 t.getchild(MNU_REMOVE_TORRENT).selectmenuitem()
105
106 ldtp.waittillguiexist(DLG_QUESTION)
107
108 if ldtp.guiexist(DLG_QUESTION):
109 q = ooldtp.context(DLG_QUESTION)
110 q.getchild(BTN_REMOVE).click()
111
112 self.assertTrue(table.getrowcount() == 0)
113
114if __name__ == "__main__":
115 unittest.main()

Subscribers

People subscribed via source and target branches