summaryrefslogtreecommitdiff
path: root/swig/python/tests
diff options
context:
space:
mode:
authorKlaus Kämpf <kkaempf@suse.de>2010-11-09 13:30:16 +0100
committerKlaus Kämpf <kkaempf@suse.de>2010-11-09 13:30:16 +0100
commit3c8c2932ffa944fbeec933d2f6b7cd077deec920 (patch)
tree168a5a6ca8a02149c1c7d9ad92e574027ed6ceb1 /swig/python/tests
parent00768743f7ab9dc9b2647b8a528e5b0af051c11a (diff)
downloadlibzypp-bindings-3c8c2932ffa944fbeec933d2f6b7cd077deec920.tar.gz
libzypp-bindings-3c8c2932ffa944fbeec933d2f6b7cd077deec920.tar.bz2
libzypp-bindings-3c8c2932ffa944fbeec933d2f6b7cd077deec920.zip
Complete CommitCallbacks with testcase
This complete the initial implementation of the callbacks concept. Currently only the 'RemoveResolvable' callback is instrumented for Python. More to come ...
Diffstat (limited to 'swig/python/tests')
-rw-r--r--swig/python/tests/commit_callbacks.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/swig/python/tests/commit_callbacks.py b/swig/python/tests/commit_callbacks.py
index c969927..ff002ae 100644
--- a/swig/python/tests/commit_callbacks.py
+++ b/swig/python/tests/commit_callbacks.py
@@ -10,7 +10,7 @@ cwd = os.path.abspath(os.path.dirname(__file__))
import sys
sys.path.insert(0, cwd + "/../../../build/swig/python")
-from zypp import CommitCallbacks
+import zypp
class CommitReceiver:
def removal_start(self, resolvable):
@@ -18,7 +18,12 @@ class CommitReceiver:
class CommitCallbacksTestCase(unittest.TestCase):
def testRemoveCallback(self):
- commit_callbacks = CommitCallbacks()
+ Z = zypp.ZYppFactory_instance().getZYpp()
+ Z.initializeTarget( zypp.Pathname("/") )
+ Z.target().load();
+
+ commit_callbacks_emitter = zypp.CommitCallbacksEmitter()
+ commit_callbacks = zypp.CommitCallbacks()
# print "commit_callbacks " , commit_callbacks
assert None == commit_callbacks.receiver()
# print "callbacks receiver is NULL - good"
@@ -28,6 +33,12 @@ class CommitCallbacksTestCase(unittest.TestCase):
# print "connected to ", commit_receiver
assert commit_receiver == commit_callbacks.receiver()
# print "callbacks receiver is set - good"
+
+ for item in Z.pool():
+ print "Emitting removal of ", item.resolvable()
+ commit_callbacks_emitter.remove_start(item.resolvable())
+ break
+
commit_callbacks.disconnect()
# print "disconnected"
assert None == commit_callbacks.receiver()