diff options
author | Klaus Kämpf <kkaempf@suse.de> | 2010-11-07 15:51:54 +0100 |
---|---|---|
committer | Klaus Kämpf <kkaempf@suse.de> | 2010-11-07 15:51:54 +0100 |
commit | 3f472770771e5ed4717c3e50fbadac9d0423272e (patch) | |
tree | c8d42808527348d2cd537469896ce91a1cb9e837 /swig/python/tests | |
parent | f90ebfce3d419a88db82e6f9c8b3d4923d7f4f62 (diff) | |
download | libzypp-bindings-3f472770771e5ed4717c3e50fbadac9d0423272e.tar.gz libzypp-bindings-3f472770771e5ed4717c3e50fbadac9d0423272e.tar.bz2 libzypp-bindings-3f472770771e5ed4717c3e50fbadac9d0423272e.zip |
Second iteration of callbacks
Define CommitCallbacks class with a connect() and disconnect() to a
callbacks receiver instance.
Add (passing) Ruby and (nonpassing) Python testcase.
Diffstat (limited to 'swig/python/tests')
-rw-r--r-- | swig/python/tests/CMakeLists.txt | 3 | ||||
-rw-r--r-- | swig/python/tests/commit_callbacks.py | 27 |
2 files changed, 29 insertions, 1 deletions
diff --git a/swig/python/tests/CMakeLists.txt b/swig/python/tests/CMakeLists.txt index 70eb6df..8424cc0 100644 --- a/swig/python/tests/CMakeLists.txt +++ b/swig/python/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# +## # CMakeLists.txt for libzypp-bindings/swig/python/tests # @@ -6,3 +6,4 @@ ENABLE_TESTING() ADD_TEST(bindings_python_loading python ${CMAKE_CURRENT_SOURCE_DIR}/loading.py) ADD_TEST(bindings_python_repoinfo python ${CMAKE_CURRENT_SOURCE_DIR}/repoinfo.py) +ADD_TEST(bindings_python_commit_callbacks python ${CMAKE_CURRENT_SOURCE_DIR}/commit_callbacks.py)
\ No newline at end of file diff --git a/swig/python/tests/commit_callbacks.py b/swig/python/tests/commit_callbacks.py new file mode 100644 index 0000000..61c9315 --- /dev/null +++ b/swig/python/tests/commit_callbacks.py @@ -0,0 +1,27 @@ +# +# Test commit callbacks +# + +import unittest + +import sys +sys.path.insert(0, '../../../../build/swig/python') + +from zypp import CommitCallbacks + +class CommitReceiver: + def removal_start(self, resolvable): + print "Starting to remove ", resolvable + +class CommitCallbacksTestCase(unittest.TestCase): + def testRemoveCallback(self): + commit_callbacks = CommitCallbacks() + assert None == commit_callbacks.receiver() + commit_receiver = CommitReceiver() + commit_callbacks.connect(commit_receiver) + assert commit_receiver == commit_callbacks.receiver() + commit_callbacks.disconnect() + assert None == commit_callbacks.receiver() + +if __name__ == '__main__': + unittest.main() |