3 # This file is part of DisOrder.
4 # Copyright (C) 2008 Richard Kettlewell
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 """Exercise alias logic"""
30 print " creating an alias in new directory"
31 track
= "%s/misc/blahblahblah.ogg" % dtest
.tracks
33 "trackname_display_artist",
36 "trackname_display_album",
39 print " checking it shows up in the right place"
40 alias
= "%s/Fred Smith/wibble/blahblahblah.ogg" % dtest
.tracks
41 files
= c
.files("%s/Fred Smith/wibble" % dtest
.tracks
)
42 assert files
== [alias
]
44 print " checking part calculation"
45 artist
= c
.part(track
, "display", "artist")
46 assert artist
== "Fred Smith", "checking artist part"
47 album
= c
.part(track
, "display", "album")
48 assert album
== "wibble", "checking album part"
49 title
= c
.part(track
, "display", "title")
50 assert title
== "blahblahblah", "checking title part"
52 print " checking part calculation on alias"
53 artist
= c
.part(alias
, "display", "artist")
54 assert artist
== "Fred Smith", "checking artist part"
55 album
= c
.part(alias
, "display", "album")
56 assert album
== "wibble", "checking album part"
57 title
= c
.part(alias
, "display", "title")
58 assert title
== "blahblahblah", "checking title part"
61 print " checking that prefs always belong to the canonical name"
62 c
.set(alias
, "wibble", "spong")
63 value
= c
.get(track
, "wibble")
64 assert value
== "spong", "checking pref ended up on resolved track"
65 c
.set(track
, "foo", "bar")
66 value
= c
.get(alias
, "foo")
67 assert value
== "bar", "checking pref visible via alias"
69 if __name__
== '__main__':