Merge lp:~roignac/mago/banshee_to_mago2 into lp:~mago-contributors/mago/mago-testsuite

Proposed by Vadim Rutkovsky
Status: Needs review
Proposed branch: lp:~roignac/mago/banshee_to_mago2
Merge into: lp:~mago-contributors/mago/mago-testsuite
Diff against target: 646 lines (+610/-0)
7 files modified
banshee/banshee.py (+315/-0)
banshee/data/extendedm3u.m3u (+11/-0)
banshee/data/extendedpls.pls (+15/-0)
banshee/data/simplem3u.m3u (+5/-0)
banshee/data/simplepls.pls (+8/-0)
banshee/test_banshee.ini (+19/-0)
banshee/test_banshee.py (+237/-0)
To merge this branch: bzr merge lp:~roignac/mago/banshee_to_mago2
Reviewer Review Type Date Requested Status
Mago Contributors Pending
Jean-Baptiste Lallement Pending
Review via email: mp+75143@code.launchpad.net

Description of the change

Ported banshee tests from mago-1.0 to mago-2.0

To post a comment you must log in.

Unmerged revisions

35. By Vadim Rutkovsky

Updated comments

34. By Vadim Rutkovsky

banshee driver cleanup

33. By Vadim Rutkovsky

Added some test descriptions

32. By Vadim Rutkovsky

Fixed teardown and added some comments

31. By Vadim Rutkovsky

Draft implementation of all tests

30. By Vadim Rutkovsky

import tests

29. By Vadim Rutkovsky

Completed test_add_podcast

28. By Vadim Rutkovsky

Completed test_enable_plugins and test_disable_plugins

27. By Vadim Rutkovsky

Started cases rewrite

26. By Vadim Rutkovsky

Started test implementation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'banshee'
2=== added file 'banshee/banshee.py'
3--- banshee/banshee.py 1970-01-01 00:00:00 +0000
4+++ banshee/banshee.py 2011-09-13 10:06:36 +0000
5@@ -0,0 +1,315 @@
6+#-*- coding:utf-8 -*-
7+"""
8+This is the "banshee" module.
9+
10+This module provides a wrapper for LDTP to make writing Banshee tests easier.
11+"""
12+import ooldtp
13+import ldtp
14+import os
15+import time
16+import gettext
17+import pygst
18+pygst.require("0.10")
19+import gst
20+import pexpect
21+import wave
22+import struct
23+import numpy as np
24+
25+class Banshee():
26+ """
27+ banshee manages the Banshee application.
28+ """
29+
30+ WINDOW = 'frmBansheeMediaPlayer'
31+
32+ WINDOW_PLAY = 'frmbanshee*'
33+
34+ BTN_6 = 'btn6'
35+ BTN_7 = 'btn7'
36+ BTN_BROWSE = 'btnBrowse'
37+ BTN_CLOSE = 'btnClose'
38+ BTN_NEXT = 'btnNext'
39+ BTN_PLAY = 'btnPlay'
40+ BTN_PREVIOUS = 'btnPrevious'
41+ BTN_REFRESH = 'btnRefresh'
42+ BTN_VOLUME = 'btnVolume'
43+ BTN_OPEN = 'btnOpen'
44+ BTN_ADDPODCAST = 'btnAddPodcast'
45+ BTN_SUBSCRIBE = 'btnSubscribe'
46+ BTN_STOP = 'btnStop'
47+ BTN_IMPORT = 'btnImport'
48+ BTN_HOME = 'btnHome'
49+ BTN_SAVE = 'btnSave'
50+ CBO_ALBUM = 'cboAlbum'
51+ DLG_PREFERENCES = 'dlgPreferences'
52+ DLG_OPENLOCATION = 'dlgOpenLocation'
53+ DLG_OPENLOCATION_1 = 'dlgOpenLocation1'
54+ DLG_SUBSCRIBE = 'dlgSubscribe'
55+ DLG_IMPORTPLAYLIST = 'dlgImportPlaylist'
56+ DLG_SMARTPLAYLIST = 'dlgNewSmartPlaylist'
57+ MNU_ABOUT = 'mnuAbout'
58+ MNU_ADDREMOTEDAAPSERVER = 'mnuAddRemoteDAAPServer'
59+ MNU_ADVANCEDCOLLECTIONSEARCHING = 'mnuAdvancedCollectionSearching'
60+ MNU_BANSHEEHOMEPAGE = 'mnuBansheeHomePage'
61+ MNU_BANSHEEUSERGUIDE_WIKI_ = 'mnuBansheeUserGuide(Wiki)'
62+ MNU_CLOSE = 'mnuClose'
63+ MNU_CONTENTS = 'mnuContents'
64+ MNU_DELETEFROMDRIVE = 'mnuDeleteFromDrive'
65+ MNU_EDITTRACKINFORMATION = 'mnuEditTrackInformation'
66+ MNU_EMPTY = 'mnuEmpty'
67+ MNU_EMPTY1 = 'mnuEmpty1'
68+ MNU_EMPTY2 = 'mnuEmpty2'
69+ MNU_EMPTY3 = 'mnuEmpty3'
70+ MNU_EMPTY4 = 'mnuEmpty4'
71+ MNU_EMPTY5 = 'mnuEmpty5'
72+ MNU_EMPTY6 = 'mnuEmpty6'
73+ MNU_EMPTY7 = 'mnuEmpty7'
74+ MNU_EMPTY8 = 'mnuEmpty8'
75+ MNU_EQUALIZER = 'mnuEqualizer'
76+ MNU_EXPORTPLAYLIST = 'mnuExportPlaylist'
77+ MNU_FIXMUSICMETADATA = 'mnuFixMusicMetadata'
78+ MNU_GETINVOLVED = 'mnuGetInvolved'
79+ MNU_IMPORTMEDIA = 'mnuImportMedia'
80+ MNU_IMPORTPLAYLIST = 'mnuImportPlaylist'
81+ MNU_JUMPTOPLAYINGSONG = 'mnuJumptoPlayingSong'
82+ MNU_MANAGEEXTENSIONS = 'mnuManageExtensions'
83+ MNU_NEWPLAYLIST = 'mnuNewPlaylist'
84+ MNU_NEWSMARTPLAYLIST = 'mnuNewSmartPlaylist'
85+ MNU_NEXT = 'mnuNext'
86+ MNU_OPENCONTAININGFOLDER = 'mnuOpenContainingFolder'
87+ MNU_OPENLOCATION = 'mnuOpenLocation'
88+ MNU_PLAY = 'mnuPlay'
89+ MNU_PREFERENCES = 'mnuPreferences'
90+ MNU_PREVIOUS = 'mnuPrevious'
91+ MNU_PROPERTIES = 'mnuProperties'
92+ MNU_QUIT = 'mnuQuit'
93+ MNU_REFRESH = 'mnuRefresh'
94+ MNU_REMOVEFROMLIBRARY = 'mnuRemoveFromLibrary'
95+ MNU_REMOVEFROMLIBRARY1 = 'mnuRemoveFromLibrary1'
96+ MNU_RENAME = 'mnuRename'
97+ MNU_RESCANMUSICLIBRARY = 'mnuRescanMusicLibrary'
98+ MNU_RESTARTSONG = 'mnuRestartSong'
99+ MNU_SEEKTO = 'mnuSeekTo'
100+ MNU_SELECTALL = 'mnuSelectAll'
101+ MNU_SELECTNONE = 'mnuSelectNone'
102+ MNU_SOURCEPROPERTIES = 'mnuSourceProperties'
103+ MNU_SWITCHSOURCE = 'mnuSwitchSource'
104+ MNU_UNMAP = 'mnuUnmap'
105+ MNU_VERSIONINFORMATION = 'mnuVersionInformation'
106+ MNU_VISITUSERPROFILEPAGE = 'mnuVisitUserProfilePage'
107+ MNU_WRITECD = 'mnuWriteCD'
108+ LBL_MIROGUIDE = 'lblPodcastDirectory-MiroGuide'
109+ TXT_0 = 'txt0'
110+ TXT_1 = 'txt1'
111+ TXT_LOCATION = 'txtLocation'
112+ PTABLE = 'ptl0'
113+ PTAB_EXTENSIONS = 'ptabExtensions'
114+ TBL = 'ttbl0'
115+ TBL_LISTVIEW = 'tblListView'
116+ TBL_LISTVIEW1 = 'tblListView1'
117+ TBL_LISTVIEW2 = 'tblListView2'
118+ TBL_LISTVIEW3 = 'tblListView3'
119+
120+ header_values = ['Community Extensions',
121+ 'Context Pane',
122+ 'Core',
123+ 'Device Support',
124+ 'Online Sources',
125+ 'Utilities']
126+
127+ def enable_disable_plugins(self, enable):
128+ """ Enable or disable all available plugins """
129+ banshee = ooldtp.context(self.WINDOW)
130+ # Open Preferences via menu
131+ banshee.selectmenuitem(self.MNU_PREFERENCES)
132+ ldtp.waittillguiexist(self.DLG_PREFERENCES)
133+ bansheePreferences = ooldtp.context(self.DLG_PREFERENCES)
134+ # Go to Extensions tab
135+ bansheePreferences.selecttab(self.PTABLE, self.PTAB_EXTENSIONS)
136+ row_count = bansheePreferences.getrowcount(self.TBL)
137+ row = 0
138+ # Enable/disable all found plugins
139+ while row < row_count:
140+ first_column = bansheePreferences.getcellvalue(self.TBL, row, 0)
141+ if first_column not in self.header_values:
142+ ldtp.log(str(self.header_values))
143+ if enable:
144+ bansheePreferences.checkrow(self.TBL, row, 1)
145+ else:
146+ bansheePreferences.uncheckrow(self.TBL, row, 1)
147+ ldtp.wait()
148+ row+=1
149+
150+ # Close Preferences dialog
151+ bansheePreferences.click(self.BTN_CLOSE)
152+ ldtp.wait()
153+ ldtp.waittillguiexist(self.WINDOW)
154+
155+ def add_podcast(self, podcast_url):
156+ banshee = ooldtp.context(self.WINDOW)
157+
158+ if not banshee.doesrowexist(self.TBL, 'Podcasts'):
159+ raise AssertionError, "The Podcast plugin was either not activated or crashed during the activation"
160+
161+ #select the podcast entry on the left side listview.
162+ banshee.selectrow(self.TBL, 'Podcasts')
163+ ldtp.wait()
164+ #remap the window since new buttons appear on it.
165+ ldtp.remap(self.WINDOW)
166+
167+ # Adding a podcast
168+ banshee.click(self.BTN_ADDPODCAST)
169+ ldtp.waittillguiexist(self.DLG_SUBSCRIBE)
170+ subscribe = ooldtp.context(self.DLG_SUBSCRIBE)
171+ subscribe.settextvalue(self.TXT_0, podcast_url)
172+ subscribe.click(self.BTN_SUBSCRIBE)
173+
174+ ldtp.wait()
175+ if not banshee.getrowcount(self.TBL_LISTVIEW) > 1:
176+ raise AssertionError, "The Podcast: %s was not added" % podcast_url
177+
178+ def import_playlist(self, playlist_path):
179+ banshee = ooldtp.context(self.WINDOW)
180+ banshee.selectmenuitem(self.MNU_IMPORTPLAYLIST)
181+
182+ ldtp.wait(2)
183+
184+ #This should be replaced this with openDocument mago function
185+
186+ if (ldtp.guiexist(self.DLG_IMPORTPLAYLIST)):
187+ selectPlaylist = ooldtp.context(self.DLG_IMPORTPLAYLIST)
188+ if not (selectPlaylist.getchild(self.TXT_LOCATION)):
189+ ldtp.generatekeyevent('<ctrl>l')
190+
191+ selectPlaylist.settextvalue(self.TXT_LOCATION, playlist_path)
192+ ldtp.wait(2)
193+ selectPlaylist.click(self.BTN_IMPORT)
194+ ldtp.wait(2)
195+
196+ ldtp.waittillguiexist(self.WINDOW)
197+ playlistName = os.path.splitext(os.path.basename(playlist_path))[0]
198+
199+ if not banshee.doesrowexist(self.TBL, playlistName):
200+ raise AssertionError, "The playlist %s was not imported into Banshee." % playlist_path
201+
202+ def play_file(self, file_path, tmp_path):
203+ banshee = ooldtp.context(self.WINDOW)
204+ banshee.selectmenuitem(self.MNU_OPENLOCATION)
205+ ldtp.wait()
206+
207+ bansheeLocation = ooldtp.context(self.DLG_OPENLOCATION)
208+
209+ #This should be replaced this with openDocument mago function
210+ bansheeLocation.click(self.BTN_BROWSE)
211+
212+ ldtp.waittillguiexist(self.DLG_OPENLOCATION_1)
213+ location = ooldtp.context(self.DLG_OPENLOCATION_1)
214+
215+ if not (location.guiexist(self.TXT_LOCATION)):
216+ ldtp.generatekeyevent('<ctrl>l')
217+ location.settextvalue(self.TXT_LOCATION, file_path)
218+ location.click(self.BTN_OPEN)
219+
220+ ldtp.wait(2)
221+
222+ bansheeLocation.click(self.BTN_OPEN)
223+ ldtp.waittillguiexist(self.WINDOW_PLAY)
224+ (freq, flat) = self.capture_do_fft(tmp_path)
225+
226+ if freq != 440:
227+ raise AssertionError, "Sine WAV playback error, frq expected: 440; got %s" % freq
228+ os.unlink(tmp_path)
229+ os.unlink(file_path)
230+
231+ def create_wav_file(self, freq, wavfile):
232+ pipeline = 'audiotestsrc freq=%d num-buffers=512 ! queue ! \
233+ audioconvert ! \
234+ audio/x-raw-int,width=16,depth=16,channels=1 ! \
235+ wavenc ! \
236+ filesink location=%s' % (freq, wavfile)
237+ element = gst.parse_launch(pipeline)
238+ element.set_state(gst.STATE_PLAYING)
239+
240+ def miro_guide(self):
241+ banshee = ooldtp.context(self.WINDOW)
242+
243+ if not banshee.doesrowexist(self.TBL, 'Miro Guide'):
244+ raise AssertionError, "The Miro Guide plugin was either not activated or crashed during the activation"
245+
246+ #select the podcast entry on the left side listview.
247+ banshee.selectrow(self.TBL, 'Miro Guide')
248+ ldtp.wait()
249+ #remap the window since new buttons appear on it.
250+ ldtp.remap(self.WINDOW)
251+ buttonHome = banshee.getchild(self.BTN_HOME)
252+ while not buttonHome.stateenabled():
253+ ldtp.wait()
254+
255+ banshee.selectrow(self.TBL, 'Music')
256+
257+ def create_smart_playlist(self, playlist_name, artist):
258+ banshee = ooldtp.context(self.WINDOW)
259+ banshee.selectmenuitem(self.MNU_NEWSMARTPLAYLIST)
260+
261+ ldtp.waittillguiexist(self.DLG_SMARTPLAYLIST)
262+ smartPlaylist = ooldtp.context(self.DLG_SMARTPLAYLIST)
263+ smartPlaylist.settextvalue(self.TXT_0, playlist_name)
264+ smartPlaylist.settextvalue(self.TXT_1, artist)
265+ comboAlbum = smartPlaylist.getchild(self.CBO_ALBUM)
266+ comboAlbum.comboselect('Artist')
267+
268+ smartPlaylist.getchild(self.BTN_SAVE).click()
269+
270+ if not banshee.doesrowexist(self.TBL, playlist_name):
271+ raise AssertionError, "The playlist %s was not created." % playlist_name
272+
273+ def capture_do_fft(self, filename):
274+ """
275+ Start a Gstreamer pipeline to record ALSA PCM output
276+ Perform FFT to find freq peak
277+
278+ Return:
279+ - the freq peak
280+ - a boolean if the PCM recorded is flat (no sound)
281+ """
282+
283+ device = pexpect.run('/bin/bash -c "pactl list | \
284+ grep -A2 \'^Source #\' | \
285+ grep -e \'Name: .*\.monitor$\' | cut -d\' \' -f2 | tail -n1"')
286+
287+ pipeline = 'pulsesrc device=%s ! queue ! audioconvert ! \
288+ audio/x-raw-int,width=16,depth=16,channels=1 ! \
289+ wavenc ! filesink location=%s' % (device.rstrip(), filename)
290+ element = gst.parse_launch(pipeline)
291+ element.set_state(gst.STATE_PLAYING)
292+ time.sleep(2)
293+ element.set_state(gst.STATE_NULL)
294+
295+ data_size = 40000
296+ frate = 44100.0
297+ wav_file = wave.open(filename,'r')
298+ data = wav_file.readframes(data_size)
299+ wav_file.close()
300+ data = struct.unpack('<{n}h'.format(n=data_size), data)
301+ data = np.array(data)
302+ w = np.fft.fft(data)
303+ freqs = np.fft.fftfreq(len(w))
304+
305+ # A flat PCM is made of the following values : -1, 0, 1 only
306+ flat = 0 if (abs(np.min(data))+abs(np.max(data))-2) else 1
307+
308+ # Find the peak in the coefficients
309+ idx = np.argmax(np.abs(w)**2)
310+ freq = freqs[idx]
311+ freq_in_hertz = abs(freq*frate)
312+ return ((int(round(freq_in_hertz))), flat)
313+
314+ def close(self):
315+ if ldtp.guiexist(self.WINDOW):
316+ ldtp.click(self.WINDOW, self.MNU_CLOSE)
317+ # Window's title is dynamic and title changes depending on the test,
318+ # last title is banshee by Unknown Artist
319+ else:
320+ ldtp.click('frm*bansheebyUnknownArtist', self.MNU_CLOSE)
321
322=== added directory 'banshee/data'
323=== added file 'banshee/data/extendedm3u.m3u'
324--- banshee/data/extendedm3u.m3u 1970-01-01 00:00:00 +0000
325+++ banshee/data/extendedm3u.m3u 2011-09-13 10:06:36 +0000
326@@ -0,0 +1,11 @@
327+#EXTM3U
328+#EXTINF:-1,Remote PLS
329+http://remote/remote.pls
330+#EXTINF:246,Local MP3
331+local.mp3
332+#EXTINF:120,Relative Local MP3
333+relative/local.mp3
334+#EXTINF:3,Spaced Relative Local MP3
335+spaced relative/local.mp3
336+#EXTINF:,Spaced Absolute Local MP3
337+/spaced absolute/local.mp3
338
339=== added file 'banshee/data/extendedpls.pls'
340--- banshee/data/extendedpls.pls 1970-01-01 00:00:00 +0000
341+++ banshee/data/extendedpls.pls 2011-09-13 10:06:36 +0000
342@@ -0,0 +1,15 @@
343+[playlist]
344+Title1=Remote PLS
345+File1=http://remote/remote.pls
346+Length1=0
347+File2=local.mp3
348+Title2=Local MP3
349+Length2=246
350+Length3=120
351+Title3=Relative Local MP3
352+File3=relative/local.mp3
353+Title4=Spaced Relative Local MP3
354+File4=spaced relative/local.mp3
355+Length4=3
356+File5=/spaced absolute/local.mp3
357+Title5=Spaced Absolute Local MP3
358
359=== added file 'banshee/data/simplem3u.m3u'
360--- banshee/data/simplem3u.m3u 1970-01-01 00:00:00 +0000
361+++ banshee/data/simplem3u.m3u 2011-09-13 10:06:36 +0000
362@@ -0,0 +1,5 @@
363+http://remote/remote.pls
364+local.mp3
365+relative/local.mp3
366+spaced relative/local.mp3
367+/spaced absolute/local.mp3
368
369=== added file 'banshee/data/simplepls.pls'
370--- banshee/data/simplepls.pls 1970-01-01 00:00:00 +0000
371+++ banshee/data/simplepls.pls 2011-09-13 10:06:36 +0000
372@@ -0,0 +1,8 @@
373+[playlist]
374+File1=http://remote/remote.pls
375+File2=local.mp3
376+File3=relative/local.mp3
377+File4=spaced relative/local.mp3
378+File5=/spaced absolute/local.mp3
379+NumberOfEntries=5
380+Version=2
381
382=== added file 'banshee/test_banshee.ini'
383--- banshee/test_banshee.ini 1970-01-01 00:00:00 +0000
384+++ banshee/test_banshee.ini 2011-09-13 10:06:36 +0000
385@@ -0,0 +1,19 @@
386+[data]
387+; Used by the test_import_extended_m3u test
388+extendedm3u=data/extendedm3u.m3u
389+; Used by the test_import_extended_pls test
390+extendedpls=data/extendedpls.pls
391+; Used by the test_import_simple_m3u test
392+simplem3u=data/simplem3u.m3u
393+; Used by the test_import_simple_pls test
394+simplepls=data/simplepls.pls
395+; Used by the test_add_podcast test
396+podcast_url=http://feeds.feedburner.com/UbuntuUkPodcastOgg-low?format=xml
397+; Used by the test_create_smart_playlist
398+#playlist_name=ⵥꜳꜼʨサボ
399+#artist=⺺⺭⺠⺓⺑⺏⻋
400+playlist_name=smart playlist
401+artist=banshee artist
402+; Used by the test_play_file
403+file_path=/tmp/banshee.wav
404+tmp_path=/tmp/banshee-capture.wav
405
406=== added file 'banshee/test_banshee.py'
407--- banshee/test_banshee.py 1970-01-01 00:00:00 +0000
408+++ banshee/test_banshee.py 2011-09-13 10:06:36 +0000
409@@ -0,0 +1,237 @@
410+# -*- coding: utf-8 -*-
411+# Copyright (C) 2010 Canonical Ltd
412+#
413+# This program is free software; you can redistribute it and/or modify
414+# it under the terms of the GNU General Public License as published by
415+# the Free Software Foundation; either version 2 of the License, or
416+# (at your option) any later version.
417+#
418+# This program is distributed in the hope that it will be useful,
419+# but WITHOUT ANY WARRANTY; without even the implied warranty of
420+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
421+# GNU General Public License for more details.
422+#
423+# You should have received a copy of the GNU General Public License
424+# along with this program; if not, write to the Free Software
425+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
426+import os
427+import shutil
428+from time import time, gmtime, strftime
429+
430+"""Banshee Test
431+
432+To run it with:
433+$ mago <path_to_this_file>
434+
435+"""
436+
437+from mago import TestCase, magoConfig
438+import unittest
439+import ldtp, ooldtp
440+import banshee
441+
442+class TestBanshee(TestCase):
443+
444+ launcher = 'banshee'
445+ window_name = 'frmBansheeMediaPlayer'
446+ setupOnce = False
447+ banshee = banshee.Banshee()
448+
449+ def tearDown(self):
450+ """ Teardown for tests - close Banshee, clear up configs and cache """
451+
452+ #remove banshee config since we imported playlists, etc.
453+ banshee_config = os.getenv('HOME') + '/.config/banshee-1'
454+ if os.path.exists(banshee_config):
455+ shutil.rmtree(banshee_config)
456+
457+ #remove banshee cache
458+ banshee_cache = os.getenv('HOME') + '/.cache/banshee-1'
459+ if os.path.exists(banshee_cache):
460+ shutil.rmtree(banshee_cache)
461+
462+ TestCase.tearDown(self)
463+
464+ def test_enable_disable_plugins(self):
465+ """ banshee_01: Enable / disable all plugins
466+ requires: banshee (optional: banshee-extension-*, banshee-community-extensions)
467+ command: banshee
468+ _description:
469+ PURPOSE:
470+ 1. Check that all plugins can be enabled and disabled without errors
471+ STEPS:
472+ 1. Open Preferences - Extensions
473+ 2. Check the box for each plugin
474+ 3. Close Preferences
475+ 4. Open Preferences - Extensions
476+ 5. Uncheck the box for each plugin
477+ 6. Close Preferences
478+ 7. Open Preferences - Extensions
479+ 8. Check the box for each plugin
480+ 9. Close Preferences
481+ VERIFICATION:
482+ 1. Banshee doesn't crash
483+ """
484+ #FIXME: Add some more info on which plugin crashed the app
485+ self.banshee.enable_disable_plugins(True)
486+ self.banshee.enable_disable_plugins(False)
487+ self.banshee.enable_disable_plugins(True)
488+
489+ def test_add_podcast(self):
490+ """ banshee_02: Add a podcast
491+ requires: banshee
492+ command: banshee
493+ _description:
494+ PURPOSE:
495+ 1. Check that podcasts can be added in Banshee
496+ STEPS:
497+ 1. Select 'Podcasts' in the tree
498+ 2. Click 'Add Podcast'
499+ 3. Input podcast url
500+ 4. Click 'Import'
501+ VERIFICATION:
502+ 1. Banshee doesn't crash
503+ 2. Play button is enabled
504+ """
505+ podcast_url = self.testConfig.get('data', 'podcast_url')
506+ self.banshee.add_podcast(podcast_url)
507+ #remove the podcast folder.
508+ podcasts_folder = os.getenv('HOME') + '/Podcasts/'
509+ if os.path.exists(podcasts_folder):
510+ shutil.rmtree(podcasts_folder)
511+
512+ def test_import_extended_m3u(self):
513+ """ banshee_03: Import an extended M3U
514+ requires: banshee
515+ command: banshee
516+ _description:
517+ PURPOSE:
518+ 1. Check that M3U playlists with special cases can be imported
519+ STEPS:
520+ 1. Select 'Import Playlist' from menu
521+ 2. Select playlist from file structure
522+ 3. Click 'Import'
523+ VERIFICATION:
524+ 1. Banshee doesn't crash
525+ 2. Playlist is added in 'Music' section
526+ """
527+ extendedm3u = self.testConfig.get('data', 'extendedm3u')
528+ path = os.path.join(os.path.dirname(__file__), extendedm3u)
529+ self.banshee.import_playlist(path)
530+
531+ def test_import_extended_pls(self):
532+ """ banshee_04: Import an extended PLS
533+ requires: banshee
534+ command: banshee
535+ _description:
536+ PURPOSE:
537+ 1. Check that PLS playlists with special cases can be imported
538+ STEPS:
539+ 1. Select 'Import Playlist' from menu
540+ 2. Select playlist from file structure
541+ 3. Click 'Import'
542+ VERIFICATION:
543+ 1. Banshee doesn't crash
544+ 2. Playlist is added in 'Music' section
545+ """
546+ extendedpls = self.testConfig.get('data', 'extendedpls')
547+ path = os.path.join(os.path.dirname(__file__), extendedpls)
548+ self.banshee.import_playlist(path)
549+
550+ def test_import_simple_m3u(self):
551+ """ banshee_05: Import a simple M3U
552+ requires: banshee
553+ command: banshee
554+ _description:
555+ PURPOSE:
556+ 1. Check that simple M3U playlists can be imported
557+ STEPS:
558+ 1. Select 'Import Playlist' from menu
559+ 2. Select playlist from file structure
560+ 3. Click 'Import'
561+ VERIFICATION:
562+ 1. Banshee doesn't crash
563+ 2. Playlist is added in 'Music' section
564+ """
565+ localconf = ".".join(os.path.basename(__file__).split('.')[:-1])
566+ simplem3u = self.testConfig.get('data', 'simplem3u')
567+ path = os.path.join(os.path.dirname(__file__), simplem3u)
568+ self.banshee.import_playlist(path)
569+
570+ def test_import_simple_pls(self):
571+ """ banshee_06: Import a simple PLS
572+ requires: banshee
573+ command: banshee
574+ _description:
575+ PURPOSE:
576+ 1. Check that simple PLS playlists can be imported
577+ STEPS:
578+ 1. Select 'Import Playlist' from menu
579+ 2. Select playlist from file structure
580+ 3. Click 'Import'
581+ VERIFICATION:
582+ 1. Banshee doesn't crash
583+ 2. Playlist is added in 'Music' section
584+ """
585+ localconf = ".".join(os.path.basename(__file__).split('.')[:-1])
586+ simplepls = self.testConfig.get('data', 'simplepls')
587+ path = os.path.join(os.path.dirname(__file__), simplepls)
588+ self.banshee.import_playlist(path)
589+
590+ def test_miro_guide(self):
591+ """ banshee_07: Open Miro Guide
592+ requires: banshee
593+ command: banshee
594+ _description:
595+ PURPOSE:
596+ 1. Check that Miro Guide can be opened
597+ STEPS:
598+ 1. Select 'Miro Guide' from the tree
599+ VERIFICATION:
600+ 1. Banshee doesn't crash
601+ 2. Miro Guide is loaded
602+ """
603+ self.banshee.miro_guide()
604+
605+ def test_play_file(self):
606+ """ banshee_08: Wav file playback
607+ requires: banshee
608+ command: banshee
609+ _description:
610+ PURPOSE:
611+ 1. Check that files can be played
612+ STEPS:
613+ 1. Create a WAV file, which contains a wave at specified frequency
614+ 2. Play the file in Banshee, capturing the output
615+ VERIFICATION:
616+ 1. Banshee doesn't crash
617+ 2. File is successfully played
618+ 3. Captured output contains the wave of the same frequency
619+ """
620+ file_path = self.testConfig.get('data', 'file_path')
621+ tmp_path = self.testConfig.get('data', 'tmp_path')
622+ self.banshee.create_wav_file(440, file_path)
623+ self.banshee.play_file(file_path, tmp_path)
624+
625+ def test_create_smart_playlist(self):
626+ """ banshee_09: Test creating smart playlist
627+ requires: banshee
628+ command: banshee
629+ _description:
630+ PURPOSE:
631+ 1. Check that smart playlists can be created
632+ STEPS:
633+ 1. Select 'New Smart Playlist' from menu
634+ 2. Input playlist name
635+ 3. Input filtered artist name
636+ 4. Click 'Save'
637+ VERIFICATION:
638+ 1. Banshee doesn't crash
639+ 2. Smart playlist appears in the tree
640+ """
641+ playlist_name = self.testConfig.get('data', 'playlist_name')
642+ artist = self.testConfig.get('data', 'artist')
643+ self.banshee.create_smart_playlist(playlist_name, artist)
644+
645+if __name__ == "__main__":
646+ unittest.main()

Subscribers

People subscribed via source and target branches