4bea3a61fca0bd2270a4590ac8e0e411d769bdbc
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 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU 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, see <http://www.gnu.org/licenses/>.
22 """Exercise alias logic"""
28 print " creating an alias in new directory"
29 track
= "%s/misc/blahblahblah.ogg" % dtest
.tracks
31 "trackname_display_artist",
34 "trackname_display_album",
37 print " checking it shows up in the right place"
38 alias
= "%s/Fred Smith/wibble/blahblahblah.ogg" % dtest
.tracks
39 files
= c
.files("%s/Fred Smith/wibble" % dtest
.tracks
)
40 assert files
== [alias
]
42 print " checking part calculation"
43 artist
= c
.part(track
, "display", "artist")
44 assert artist
== "Fred Smith", "checking artist part"
45 album
= c
.part(track
, "display", "album")
46 assert album
== "wibble", "checking album part"
47 title
= c
.part(track
, "display", "title")
48 assert title
== "blahblahblah", "checking title part"
50 print " checking part calculation on alias"
51 artist
= c
.part(alias
, "display", "artist")
52 assert artist
== "Fred Smith", "checking artist part"
53 album
= c
.part(alias
, "display", "album")
54 assert album
== "wibble", "checking album part"
55 title
= c
.part(alias
, "display", "title")
56 assert title
== "blahblahblah", "checking title part"
59 print " checking that prefs always belong to the canonical name"
60 c
.set(alias
, "wibble", "spong")
61 value
= c
.get(track
, "wibble")
62 assert value
== "spong", "checking pref ended up on resolved track"
63 c
.set(track
, "foo", "bar")
64 value
= c
.get(alias
, "foo")
65 assert value
== "bar", "checking pref visible via alias"
67 if __name__
== '__main__':