aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarja Hassinen <ext-marja.2.hassinen@nokia.com>2009-09-17 14:30:54 +0300
committerMarja Hassinen <ext-marja.2.hassinen@nokia.com>2009-09-17 14:30:54 +0300
commit534963cbf4850e9630c765398d1b278fe9f681d4 (patch)
treee689a3efc175760d980e83d74e42349a55d44247
parentdc523b12969f9828f5ae82642d65b7f33ce57c3e (diff)
libcontextsubscriber, plugin loading: CLTool'izing the cust. test.
-rwxr-xr-xlibcontextsubscriber/customer-tests/pluginchanging/pluginchanging.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/libcontextsubscriber/customer-tests/pluginchanging/pluginchanging.py b/libcontextsubscriber/customer-tests/pluginchanging/pluginchanging.py
index da5fbdf3..9a5866c1 100755
--- a/libcontextsubscriber/customer-tests/pluginchanging/pluginchanging.py
+++ b/libcontextsubscriber/customer-tests/pluginchanging/pluginchanging.py
@@ -30,9 +30,7 @@ import string
from subprocess import Popen, PIPE
import time
import signal
-
-def proc_kill(pid):
- os.system('../common/rec-kill.sh %d' % pid)
+from cltool import CLTool
def timeoutHandler(signum, frame):
raise Exception('tests have been running for too long')
@@ -52,10 +50,9 @@ class Subscription(unittest.TestCase):
os.system('cp ../testplugins/libcontextsubscribertime1.so* .')
os.system('cp ../testplugins/libcontextsubscribertime2.so* .')
- self.context_client = Popen(["context-listen","Test.Time"],stdin=PIPE,stdout=PIPE,stderr=PIPE)
+ self.context_client = CLTool("context-listen", "Test.Time")
def tearDown(self):
- proc_kill(self.context_client.pid)
os.remove('time.context')
os.system('rm libcontextsubscribertime*.so*')
@@ -65,22 +62,16 @@ class Subscription(unittest.TestCase):
os.system('cp time1.context.temp time.context.temp')
os.system('mv time.context.temp time.context')
#print "now reading"
- actual = self.context_client.stdout.readline().rstrip()
- #print actual
- # The client got a value provided by the libcontextsubscribertime1
- self.assertEqual(actual.startswith("Test.Time = QString:Time1: "), True, "Got: %s" % actual)
+ # Expect value coming from plugin libcontextsubscribertime1
+ self.assert_(self.context_client.expect(CLTool.STDOUT, "Test.Time = QString:Time1:", 3))
# Modify the registry so that the key is now provided by libcontextsubscribertime2
os.system('cp time2.context.temp time.context.temp')
os.system('mv time.context.temp time.context')
- # Assert that the client starts getting the value from the correct plugin
- # (not necessarily the first one)
- actual = self.context_client.stdout.readline().rstrip()
- actual = self.context_client.stdout.readline().rstrip()
-
- self.assertEqual(actual.startswith("Test.Time = QString:Time2: "), True, "Got: %s" % actual)
+ # Expect value coming from plugin libcontextsubscribertime2
+ self.assert_(self.context_client.expect(CLTool.STDOUT, "Test.Time = QString:Time2:", 3))
if __name__ == "__main__":
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 1)