Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] <rest-service> patch_refactor : Full SearchName test for PackageKit/D-Bus
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Fri, 25 Sep 2009 18:03:46 +0200
  • Message-id: <E1MrDIN-0001OL-Ot@xxxxxxxxxxxxxxxx>
ref: refs/heads/patch_refactor
commit 826d88a280dbb17d657f3fd765aa336d6f1c9a28
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Fri Sep 25 18:03:46 2009 +0200

Full SearchName test for PackageKit/D-Bus

This uses PackageKitStub and PackageKitResult to test the 'execute'
method of app/models/resolvables.
---
plugins/patches/test/unit/resolvable_test.rb | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/plugins/patches/test/unit/resolvable_test.rb
b/plugins/patches/test/unit/resolvable_test.rb
index f2d7688..aefc6a8 100644
--- a/plugins/patches/test/unit/resolvable_test.rb
+++ b/plugins/patches/test/unit/resolvable_test.rb
@@ -12,16 +12,25 @@ class ResolvableTest < ActiveSupport::TestCase
require 'resolvable'

def setup
- PackageKitStub.stub!
+ @pk_stub = PackageKitStub.new
end

+ # (dummy) test 'SearchName'
+ # this mostly tests correct stubbing
def test_resolvable_search
- Resolvable.execute( "SearchName", ["installed;~devel", "yast2"],
"Package") do |info,id,summary|
- assert info
- assert id
- assert summary
+ results = Array.new
+ results << PackageKitResult.new( "info1", "id1", "summary1" )
+ results << PackageKitResult.new( "info2", "id2", "summary2" )
+ signal = "Package"
+ @pk_stub.run signal, results
+ count = 0
+ Resolvable.execute( "SearchName", ["installed;~devel", "yast2"], signal)
do |info,id,summary|
+ assert_equal results[count].info, info
+ assert_equal results[count].id, id
+ assert_equal results[count].summary, summary
+ count += 1
end
-
+ assert_equal results.size, count
end

end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages