summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--swig/CommitCallbacks.h24
-rw-r--r--swig/python/tests/commit_callbacks.py15
2 files changed, 35 insertions, 4 deletions
diff --git a/swig/CommitCallbacks.h b/swig/CommitCallbacks.h
index a626122..881cd59 100644
--- a/swig/CommitCallbacks.h
+++ b/swig/CommitCallbacks.h
@@ -3,8 +3,8 @@ class CommitCallbacks {
private:
PatchMessageReportReceiver _messageReceiver;
PatchScriptReportReceiver _scriptReceiver;
- RemoveResolvableReportReceiver _installReceiver;
- InstallResolvableReportReceiver _removeReceiver;
+ RemoveResolvableReportReceiver _removeReceiver;
+ InstallResolvableReportReceiver _installReceiver;
Target_Type _instance;
public:
@@ -66,3 +66,23 @@ class CommitCallbacks {
return _instance;
}
};
+
+
+/*
+ * A (dummy) commit callback emitter used for testing only
+ *
+ */
+
+class CommitCallbacksEmitter {
+ private:
+ callback::SendReport<target::rpm::RemoveResolvableReport> remove_resolvable;
+ callback::SendReport<target::PatchMessageReport> patch_message;
+ callback::SendReport<target::PatchScriptReport> patch_script;
+ callback::SendReport<target::rpm::InstallResolvableReport> install_resolvable;
+ public:
+ void remove_start(zypp::ResObject::constPtr resobj)
+ {
+ remove_resolvable->start( resobj );
+ }
+};
+
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()