chiark / gitweb /
Add 'adopt' command. This adopts a randomly picked track by changing
[disorder] / tests / search.py
index 01ab893efa5360f742a2bb738ec6be95fdfd78c0..7774d880df7827bcc4ec417efc0b5563d2561ced 100755 (executable)
@@ -1,22 +1,20 @@
 #! /usr/bin/env python
 #
 # This file is part of DisOrder.
-# Copyright (C) 2007 Richard Kettlewell
+# Copyright (C) 2007, 2008 Richard Kettlewell
 #
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 import dtest,time,disorder,sys
 
@@ -41,7 +39,8 @@ def check_search_results(terms, expected):
 def test():
     """Check that the search produces the right results"""
     dtest.start_daemon()
-    time.sleep(2)                       # give rescan a chance
+    dtest.create_user()
+    dtest.rescan()
     global client
     client = disorder.client()
     first = ["Joe Bloggs/First Album/01:F\xC3\x8Crst track.ogg",
@@ -88,6 +87,8 @@ def test():
     check_search_results([u"fi\u0300rst"], first)
     check_search_results([u"THI\u0301RD"], third)
     check_search_results([u"thI\u0301rd"], third)
+    # stopwords shouldn't show up
+    check_search_results(["01"], [])
     
     if failures > 0:
         sys.exit(1)