Commit 283061b4 authored by blam's avatar blam

[libcontentaction] Remove qt5-default dependency

Not required, qt4->5 build handling removed from other build
scripts a long time ago.
parent 30c7ae89
#! /usr/bin/python
#! /usr/bin/python3
# coding=UTF-8
# This program generates the complicated regular expressions used in
......@@ -49,8 +49,8 @@ def rx_opt (rx):
return rx_repeat (rx, 0, 1)
def rx_output (rx, name):
print("s/@%s@/%s/g\n" % (name,
rx.replace('\\', '\\\\').replace('/', '\\/').replace('"', '\"').replace('&', '\&')))
print(("s/@%s@/%s/g\n" % (name,
rx.replace('\\', '\\\\').replace('/', '\\/').replace('"', '\"').replace('&', '\&'))))
## Phone numbers
......
......@@ -4,7 +4,7 @@ import subprocess
import functools
#
# Note: unittest in python < 2.7 doesn't support expectedFailures
# Note: this was originally written with python2.7 unittest which doesn't support expectedFailures
#
def escape_for_shell (str):
......@@ -32,8 +32,8 @@ class LocalRegexTest (unittest.TestCase):
parts = self.__spec.split (self.__delimiter)
text = "".join (parts)
expected = [ parts[i] for i in range (1, len (parts), 2) ]
result = list (map (lambda m: m.group(0), re.finditer (self.__regex, text)))
self.assertEquals (result, expected)
result = list ([m.group(0) for m in re.finditer (self.__regex, text)])
self.assertEqual (result, expected)
class SystemRegexTest (unittest.TestCase):
......@@ -83,7 +83,7 @@ class SystemRegexTest (unittest.TestCase):
expected_result = expected.pop (0)
self.assertEquals (result[1:-1], expected_result,
self.assertEqual (result[1:-1], expected_result,
"'%s' is not recognized properly " % (self.__spec)
+ "(matched '%s' instead of '%s')" % (result,
expected_result)
......
......@@ -15,7 +15,7 @@ BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(Qt5Xml)
BuildRequires: pkgconfig(Qt5SystemInfo)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: python
BuildRequires: python3-base
BuildRequires: qt5-qttools-linguist
%description
......@@ -34,11 +34,10 @@ libcontentaction library.
%package tests
Summary: Tests for libcontentaction
Requires: %{name} = %{version}-%{release}
Requires: dbus-python
Requires: pygobject2
Requires: python
Requires: dbus-python3
Requires: python3-gobject
Requires: python3-base
Requires: tracker-utils
Requires: qt5-default
Requires: qt5-qttools-qdbus
%description tests
......
......@@ -5,7 +5,7 @@ GenericName=Launch Me
Comment=Test helper
X-Maemo-Service=just.a.gallery
X-Maemo-Method=com.nokia.galleryserviceinterface.showImage
Exec=python -c "f = open('/tmp/actionParams', 'w'); f.write('The params are %U');"
Exec=python3 -c "f = open('/tmp/actionParams', 'w'); f.write('The params are %U');"
X-Maemo-Fixed-Args=these;are;fixed
Terminal=false
MimeType=text/*;
......
......@@ -6,7 +6,7 @@ Name[de]=deutschexec
GenericName=Uber Program
Icon=execicon
Comment=View ANYTHING
Exec=python -c "f = open(%U); content=f.read(); f2 = open('/tmp/executedAction', 'w'); f2.write(content);"
Exec=python3 -c "f = open(%U); content=f.read(); f2 = open('/tmp/executedAction', 'w'); f2.write(content);"
Terminal=false
Type=Application
MimeType=text/plain;
......
......@@ -2,7 +2,7 @@
Encoding=UTF-8
Name=UriPrinter
Comment=Just prints the params into a file
Exec=python -c "f2 = open('/tmp/executedAction', 'w'); f2.write(\\"%U\\n\\");"
Exec=python3 -c "f2 = open('/tmp/executedAction', 'w'); f2.write(\\"%U\\n\\");"
Terminal=false
Type=Application
MimeType=image/png;
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2009 Nokia. All rights reserved.
##
......@@ -18,7 +18,7 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
## 02110-1301 USA
from __future__ import with_statement
import os
import re
......@@ -99,7 +99,7 @@ class CLTool:
with self.iolock:
self.io.append((time.time(), CLTool.STDIN, string))
try:
print >>self.process.stdin, string
print(string, file=self.process.stdin)
self.process.stdin.flush()
except:
self.printio()
......@@ -115,7 +115,7 @@ class CLTool:
"""Compute the output read since the last match."""
r = []
with self.iolock:
for pos in xrange(self.last_expect, len(self.io)):
for pos in range(self.last_expect, len(self.io)):
ts, fno, l = self.io[pos]
if fno == CLTool.STDOUT:
r.append(l)
......@@ -193,8 +193,8 @@ class CLTool:
def printio(self):
"""Dump the io log to the standard output."""
print
print '-' * 72
print()
print('-' * 72)
with self.iolock:
for ts, fno, line in self.io:
line = line.rstrip("\r\n")
......@@ -203,8 +203,8 @@ class CLTool:
if fno == CLTool.COMMENT: info = "###";
if fno == CLTool.STDIN: info = "<--";
if fno == CLTool.STDOUT: info = "-->";
print "%s %s %s" % (t, info, line)
print '-' * 72
print("%s %s %s" % (t, info, line))
print('-' * 72)
sys.stdout.flush()
def wanted(name, type, value):
......
#!/usr/bin/python
#!/usr/bin/python3
import dbus, dbus.service, dbus.mainloop.glib
from gi.repository import GObject as gobject
from sys import stdout, argv
......@@ -11,11 +11,11 @@ class Gallery(dbus.service.Object):
@dbus.service.method(dbus_interface='com.nokia.galleryserviceinterface',
in_signature='as', out_signature='b')
def showImage(self, uris):
print 'showImage ; %s' % (','.join(uris))
print('showImage ; %s' % (','.join(uris)))
stdout.flush()
return True
print "started"
print("started")
stdout.flush()
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
# if there is a command line parameter, use it as bus name (otherwise, use the
......
......@@ -3,7 +3,7 @@ Encoding=UTF-8
Name=launchme
GenericName=Launch Me
Comment=Test helper
Exec=python -c "f = open('/tmp/launchedAction', 'w'); f.write('I was launched');"
Exec=python3 -c "f = open('/tmp/launchedAction', 'w'); f.write('I was launched');"
Terminal=false
Type=Application
#!/usr/bin/python
#!/usr/bin/python3
import os
import dbus, dbus.service, dbus.mainloop.glib
from gi.repository import GObject as gobject
......@@ -10,9 +10,9 @@ class ServiceMapper(dbus.service.Object):
dbus.SessionBus())
self.mapping = {}
try:
execfile('service.map')
exec(compile(open('service.map', "rb").read(), 'service.map', 'exec'))
except IOError:
execfile(os.path.dirname(__file__) + '/service.map')
exec(compile(open(os.path.dirname(__file__) + '/service.map', "rb").read(), os.path.dirname(__file__) + '/service.map', 'exec'))
@dbus.service.method(dbus_interface='com.nokia.MServiceFwIf',
in_signature='s', out_signature='s')
......@@ -37,12 +37,12 @@ class ServiceMapper(dbus.service.Object):
@dbus.service.signal(dbus_interface='com.nokia.MServiceFwIf',
signature='ss')
def serviceAvailable(self, implementor, interface):
print "emit service available", implementor, interface
print("emit service available", implementor, interface)
@dbus.service.signal(dbus_interface='com.nokia.MServiceFwIf',
signature='s')
def serviceUnavailable(self, implementor):
print "emit service unavailable", implementor
print("emit service unavailable", implementor)
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
napper = ServiceMapper('/')
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2008, 2009 Nokia. All rights reserved.
##
......@@ -27,7 +27,7 @@ try: import env
except: pass
import unittest
from commands import getstatusoutput
from subprocess import getstatusoutput
from cltool import CLTool
from tempfile import mkdtemp
from shutil import rmtree
......@@ -42,35 +42,35 @@ class Defaults(unittest.TestCase):
def testSettingDefault(self):
(status, output) = getstatusoutput("lca-tool --setmimedefault text/plain ubermeego")
self.assert_(status == 0)
self.assertTrue(status == 0)
(status, output) = getstatusoutput("lca-tool --mimedefault text/plain")
self.assert_(status == 0)
self.assert_(output.find("ubermeego") != -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("ubermeego") != -1)
def testDefaultIsFirst(self):
(status, output) = getstatusoutput("lca-tool --setmimedefault text/plain uberexec")
self.assert_(status == 0)
self.assertTrue(status == 0)
(status, output) = getstatusoutput("lca-tool --actionsformime text/plain")
self.assert_(status == 0)
self.assert_(output.find("uberexec") < output.find("ubermeego"))
self.assert_(output.find("uberexec") < output.find("ubermimeopen"))
self.assertTrue(status == 0)
self.assertTrue(output.find("uberexec") < output.find("ubermeego"))
self.assertTrue(output.find("uberexec") < output.find("ubermimeopen"))
def testResettingDefault(self):
# check what are the actions (in order) before
(status, oldactions) = getstatusoutput("lca-tool --actionsformime text/plain")
self.assert_(status == 0)
self.assertTrue(status == 0)
(status, output) = getstatusoutput("lca-tool --setmimedefault text/plain ubermeego")
self.assert_(status == 0)
self.assertTrue(status == 0)
(status, output) = getstatusoutput("lca-tool --resetmimedefault text/plain")
self.assert_(status == 0)
self.assertTrue(status == 0)
(status, newactions) = getstatusoutput("lca-tool --actionsformime text/plain")
self.assert_(status == 0)
self.assert_(newactions == oldactions)
self.assertTrue(status == 0)
self.assertTrue(newactions == oldactions)
def runTests():
suite = unittest.TestLoader().loadTestsFromTestCase(Defaults)
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2010 Nokia. All rights reserved.
##
......@@ -27,7 +27,7 @@ try: import env
except: pass
import unittest
from commands import getstatusoutput
from subprocess import getstatusoutput
from cltool import CLTool
import time
......@@ -40,20 +40,20 @@ class Launching(unittest.TestCase):
def testActionsForDesktop(self):
filename = "file://" + testfiles_dir + "/launchme.desktop"
(status, output) = getstatusoutput("lca-tool --file --print " + filename)
self.assert_(status == 0)
self.assert_(output.find("launchme") != -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("launchme") != -1)
def testLaunch(self):
filename = "file://" + testfiles_dir + "/launchme.desktop"
(status, output) = getstatusoutput("lca-tool --file --triggerdefault " + filename)
self.assert_(status == 0)
self.assertTrue(status == 0)
time.sleep(3)
f = open('/tmp/launchedAction')
content = f.read()
f.close()
os.remove("/tmp/launchedAction")
self.assert_(content.find("I was launched") != -1)
self.assertTrue(content.find("I was launched") != -1)
def testLaunchWithParams(self):
(status, output) = getstatusoutput("lca-tool --triggerdesktop uriprinter.desktop param1 param2 param3")
......@@ -61,8 +61,8 @@ class Launching(unittest.TestCase):
content = f.read()
f.close()
os.remove("/tmp/executedAction")
self.assert_(status == 0)
self.assert_(content.find("'param1' 'param2' 'param3'") != -1)
self.assertTrue(status == 0)
self.assertTrue(content.find("'param1' 'param2' 'param3'") != -1)
def runTests():
suite = unittest.TestLoader().loadTestsFromTestCase(Launching)
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2010 Nokia. All rights reserved.
##
......@@ -27,7 +27,7 @@ try: import env
except: pass
import unittest
from commands import getstatusoutput
from subprocess import getstatusoutput
from cltool import CLTool
# this controls where the test files are
......@@ -39,7 +39,7 @@ class FixedParams(unittest.TestCase):
def setUp(self):
# start a fake gallery service
self.gallery = CLTool("gallery.py")
self.assert_(self.gallery.expect("started"))
self.assertTrue(self.gallery.expect("started"))
def tearDown(self):
self.gallery.kill()
......@@ -47,9 +47,9 @@ class FixedParams(unittest.TestCase):
def testInvokeWithFixedParams(self):
filename = "file://" + testfiles_dir + "/plaintext"
(status, output) = getstatusoutput("lca-tool --file --trigger fixedparams " + filename)
self.assert_(status == 0)
self.assertTrue(status == 0)
# assert that the gallery was invoked and the fixed params got prepended
self.assert_(self.gallery.expect("showImage ; these,are,fixed," + filename))
self.assertTrue(self.gallery.expect("showImage ; these,are,fixed," + filename))
def runTests():
suite = unittest.TestLoader().loadTestsFromTestCase(FixedParams)
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2008, 2009 Nokia. All rights reserved.
##
......@@ -27,7 +27,7 @@ try: import env
except: pass
import unittest
from commands import getstatusoutput
from subprocess import getstatusoutput
from cltool import CLTool
# this controls where the test files are
......@@ -40,14 +40,14 @@ class InvalidDefaults(unittest.TestCase):
# this uri is a ncal:Event, and x-maemo-nepomuk/calendar-event has a
# mimeapps.list entry pointing to a nonexistent application.
(status, output) = getstatusoutput("lca-tool --tracker --printdefault urn:test:calendarevent")
self.assert_(status == 0)
self.assert_(output.find("Invalid action") != -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("Invalid action") != -1)
def testInvalidDefaultForFile(self):
filename = "file://" + testfiles_dir + "/empty.pdf"
(status, output) = getstatusoutput("lca-tool --file --printdefault " + filename)
self.assert_(status == 0)
self.assert_(output.find("Invalid action") != -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("Invalid action") != -1)
def runTests():
suite = unittest.TestLoader().loadTestsFromTestCase(InvalidDefaults)
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2008, 2009 Nokia. All rights reserved.
##
......@@ -27,57 +27,57 @@ try: import env
except: pass
import unittest
from commands import getstatusoutput
from subprocess import getstatusoutput
from cltool import CLTool
class Actions(unittest.TestCase):
def setUp(self):
# start a fake gallery service
self.gallery = CLTool("gallery.py")
self.assert_(self.gallery.expect("started"))
self.assertTrue(self.gallery.expect("started"))
def tearDown(self):
self.gallery.kill()
def testInvokeForImage(self):
(status, output) = getstatusoutput("lca-tool --tracker --trigger gallerywithfilename an.image")
self.assert_(status == 0)
self.assertTrue(status == 0)
# assert that the gallery was invoked
self.assert_(self.gallery.expect("showImage ; file:///tmp.aaa.jpg"))
self.assertTrue(self.gallery.expect("showImage ; file:///tmp.aaa.jpg"))
def testInvokeForTwoImages(self):
(status, output) = getstatusoutput("lca-tool --tracker --trigger gallerywithfilename an.image b.image")
self.assert_(status == 0)
self.assertTrue(status == 0)
# assert that the gallery was invoked
self.assert_(self.gallery.expect("showImage ; file:///tmp/aaa.jpg,file:///tmp/bbb.png"))
self.assertTrue(self.gallery.expect("showImage ; file:///tmp/aaa.jpg,file:///tmp/bbb.png"))
def testInvokeForInvalid(self):
(status, output) = getstatusoutput("lca-tool --tracker --triggerdefault invalid.uri")
self.assert_(status >> 8 == 4)
self.assertTrue(status >> 8 == 4)
def testInvokeForDifferentClasses(self):
(status, output) = getstatusoutput("lca-tool --tracker --triggerdefault an.image a.contact")
self.assert_(status >> 8 == 4)
self.assertTrue(status >> 8 == 4)
def testInvokeEnclosure(self):
# We have "<urn:test:encl1> mfo:localLink <an.image>", and
# triggering it should go indirectly via <an.image>.
(status, output) = getstatusoutput("lca-tool --tracker --trigger gallerywithfilename urn:test:encl1")
self.assert_(status == 0)
self.assert_(self.gallery.expect("showImage ; /tmp/aaa.jpg"))
self.assertTrue(status == 0)
self.assertTrue(self.gallery.expect("showImage ; /tmp/aaa.jpg"))
def testEnclosureDefaults(self):
# We have "<urn:test:encl1> mfo:localLink <an.image>", and
# <urn:test:encl1> and <an.image> should have the same
# defaults.
(status, encldef) = getstatusoutput("lca-tool --tracker --printdefault urn:test:encl1")
self.assert_(status == 0)
self.assertTrue(status == 0)
(status, imgdef) = getstatusoutput("lca-tool --file --printdefault /tmp/aaa.jpg")
self.assert_(status == 0)
self.assertTrue(status == 0)
# get the last line of the output
encldef = encldef.split('\n')[-1]
imgdef = imgdef.split('\n')[-1]
self.assert_(encldef != "" and encldef == imgdef)
self.assertTrue(encldef != "" and encldef == imgdef)
def runTests():
suite = unittest.TestLoader().loadTestsFromTestCase(Actions)
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2010 Nokia. All rights reserved.
##
......@@ -27,7 +27,7 @@ try: import env
except: pass
import unittest
from commands import getstatusoutput
from subprocess import getstatusoutput
from cltool import CLTool
# this controls where the test files are
......@@ -39,52 +39,52 @@ class Mimes(unittest.TestCase):
def testActionsForPlain(self):
filename = "file://" + testfiles_dir + "/plaintext"
(status, output) = getstatusoutput("lca-tool --file --print " + filename)
self.assert_(status == 0)
self.assert_(output.find("uberexec") != -1)
self.assert_(output.find("ubermeego") != -1)
self.assert_(output.find("ubermimeopen") != -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("uberexec") != -1)
self.assertTrue(output.find("ubermeego") != -1)
self.assertTrue(output.find("ubermimeopen") != -1)
def testInvokeMeego(self):
program = CLTool("uberprogram.py")
self.assert_(program.expect("started"))
self.assertTrue(program.expect("started"))
filename = "file://" + testfiles_dir + "/plaintext"
(status, output) = getstatusoutput("lca-tool --file --trigger ubermeego " + filename)
self.assert_(status == 0)
self.assertTrue(status == 0)
self.assert_(program.expect("launch: "))
self.assertTrue(program.expect("launch: "))
program.kill()
def testInvokeMimeOpen(self):
program = CLTool("uberprogram.py")
self.assert_(program.expect("started"))
self.assertTrue(program.expect("started"))
filename = "file://" + testfiles_dir + "/plaintext"
(status, output) = getstatusoutput("lca-tool --file --trigger ubermimeopen " + filename)
self.assert_(status == 0)
self.assertTrue(status == 0)
self.assert_(program.expect("mime_open:"))
self.assertTrue(program.expect("mime_open:"))
program.kill()
def testInvokeExec(self):
filename = "file://" + testfiles_dir + "/plaintext"
(status, output) = getstatusoutput("lca-tool --file --trigger uberexec " + filename)
self.assert_(status == 0)
self.assertTrue(status == 0)
f = open("/tmp/executedAction")
content = f.read()
f.close()
os.remove("/tmp/executedAction")
self.assert_(content.find("This is plain text") != -1)
self.assertTrue(content.find("This is plain text") != -1)
def testInvokeExecMulti(self):
filename = testfiles_dir + "/plaintext"
(status, output) = getstatusoutput("lca-tool --file --trigger unterexec " + filename + " " + filename + "2")
self.assert_(status == 0)
self.assertTrue(status == 0)
f = open("/tmp/executedParams")
content = f.read()
f.close()
os.remove("/tmp/executedParams")
self.assert_(content == filename + "\n" + filename + "2\n");
self.assertTrue(content == filename + "\n" + filename + "2\n");
def runTests():
suite = unittest.TestLoader().loadTestsFromTestCase(Mimes)
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2008-2010 Nokia. All rights reserved.
##
......@@ -27,7 +27,7 @@ try: import env
except: pass
import unittest
from commands import getstatusoutput
from subprocess import getstatusoutput
from cltool import CLTool
from tempfile import mkdtemp
......@@ -40,76 +40,76 @@ class Regexps(unittest.TestCase):
def testStringMimes1(self):
# only the general
(status, output) = getstatusoutput("lca-tool --string --printmimes foo")
self.assert_(status == 0)
self.assert_(output.find("general-1") != -1)
self.assert_(output.find("special-1a") == -1)
self.assert_(output.find("special-1b") == -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("general-1") != -1)
self.assertTrue(output.find("special-1a") == -1)
self.assertTrue(output.find("special-1b") == -1)
# general and one special case
(status, output) = getstatusoutput("lca-tool --string --printmimes foobar")
self.assert_(status == 0)
self.assert_(output.find("special-1a") != -1)
self.assert_(output.find("general-1") != -1)
self.assert_(output.find("special-1b") == -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("special-1a") != -1)
self.assertTrue(output.find("general-1") != -1)
self.assertTrue(output.find("special-1b") == -1)
# verify the order
self.assert_(output.find("special-1a") < output.find("general-1"))
self.assertTrue(output.find("special-1a") < output.find("general-1"))
# general and another special case
(status, output) = getstatusoutput("lca-tool --string --printmimes foobazxx")
self.assert_(status == 0)
self.assert_(output.find("special-1b") != -1)
self.assert_(output.find("general-1") != -1)
self.assert_(output.find("special-1a") == -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("special-1b") != -1)
self.assertTrue(output.find("general-1") != -1)
self.assertTrue(output.find("special-1a") == -1)
# verify the order
self.assert_(output.find("special-1b") < output.find("general-1"))
self.assertTrue(output.find("special-1b") < output.find("general-1"))
def testStringMimes2(self):
# only the general
(status, output) = getstatusoutput("lca-tool --string --printmimes cat")
self.assert_(status == 0)
self.assert_(output.find("general-2") != -1)
self.assert_(output.find("special-2") == -1)
self.assert_(output.find("superspecial-2") == -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("general-2") != -1)
self.assertTrue(output.find("special-2") == -1)
self.assertTrue(output.find("superspecial-2") == -1)
# general and one special case
(status, output) = getstatusoutput("lca-tool --string --printmimes catdog")
self.assert_(status == 0)
self.assert_(output.find("general-2") != -1)
self.assert_(output.find("special-2") != -1)
self.assert_(output.find("superspecial-2") == -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("general-2") != -1)
self.assertTrue(output.find("special-2") != -1)
self.assertTrue(output.find("superspecial-2") == -1)
# verify the order
self.assert_(output.find("special-2") < output.find("general-2"))
self.assertTrue(output.find("special-2") < output.find("general-2"))
# general and both special cases
(status, output) = getstatusoutput("lca-tool --string --printmimes catdogzebra")
self.assert_(status == 0)
self.assert_(output.find("general-2") != -1)
self.assert_(output.find("special-2") != -1)
self.assert_(output.find("superspecial-2") != -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("general-2") != -1)
self.assertTrue(output.find("special-2") != -1)
self.assertTrue(output.find("superspecial-2") != -1)
# verify the order
self.assert_(output.find("special-2") < output.find("general-2"))
self.assert_(output.find("superspecial-2") < output.find("special-2"))
self.assertTrue(output.find("special-2") < output.find("general-2"))
self.assertTrue(output.find("superspecial-2") < output.find("special-2"))
def testActionsForString(self):
(status, output) = getstatusoutput("lca-tool --string --print www.foo.com")
self.assert_(status == 0)
self.assert_(output.find("browser") != -1)
self.assert_(output.find("special-browser") == -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("browser") != -1)
self.assertTrue(output.find("special-browser") == -1)
(status, output) = getstatusoutput("lca-tool --string --print http://example.com")
self.assert_(status == 0)
self.assert_(output.find("special-browser") != -1)
self.assert_(output.find("browser") != -1)
self.assert_(output.find("special-browser") < output.find("browser"))
self.assertTrue(status == 0)
self.assertTrue(output.find("special-browser") != -1)
self.assertTrue(output.find("browser") != -1)
self.assertTrue(output.find("special-browser") < output.find("browser"))
def testDefaultActionForString(self):
(status, output) = getstatusoutput("lca-tool --string --printdefault www.foo.com")
self.assert_(status == 0)
self.assert_(output.find("browser") != -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("browser") != -1)
(status, output) = getstatusoutput("lca-tool --string --printdefault http://example.com")
self.assert_(status == 0)
self.assert_(output.find("special-browser") != -1)
self.assertTrue(status == 0)
self.assertTrue(output.find("special-browser") != -1)
def runTests():
suite = unittest.TestLoader().loadTestsFromTestCase(Regexps)
......
#!/usr/bin/python
#!/usr/bin/python3
##
## Copyright (C) 2008, 2009 Nokia. All rights reserved.
##
......@@ -34,14 +34,14 @@ class ServiceFWSignals(unittest.TestCase):
def setUp(self):
# start 2 fake gallery services
self.gallery = CLTool("gallery.py", "just.a.gallery")
self.assert_(self.gallery.expect("started"))
self.assertTrue(self.gallery.expect("started"))
self.gallery2 = CLTool("gallery.py", "just.another.gallery")
self.assert_(self.gallery2.expect("started"))
self.assertTrue(self.gallery2.expect("started"))
# reset the mapping inside the service mapper
p = Popen('qdbus com.nokia.MServiceFw / org.maemo.contentaction.testing.changeMapping "just.a.gallery" "com.nokia.galleryserviceinterface"', shell=True)
sts = os.waitpid(p.pid, 0)[1]
self.assert_(sts == 0)
self.assertTrue(sts == 0)
def tearDown(self):
self.