Permalink
Browse files

don't raise exception on empty search result

[delivers #40460601]

Change-Id: I37942d222901f18fe2262b0eeb5eeaf5df82845a
  • Loading branch information...
1 parent b957934 commit 8b264384ac02495f660f20e267230d1df4e866f3 @daleolds daleolds committed Nov 30, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −3 gem/lib/uaa/user_account.rb
  2. +5 −0 gem/spec/cli_spec.rb
@@ -67,9 +67,7 @@ def get_object_by_name(path, name_attr, name)
def all_ids(method, users)
filter = users.each_with_object([]) { |u, o| o << "userName eq \"#{u}\" or id eq \"#{u}\"" }
- qinfo = all_pages(method, attributes: "userName,id", filter: filter.join(" or "))
- raise NotFound, "users not found in #{@target}#{path}" unless qinfo[0] && qinfo[0][:id]
- qinfo
+ all_pages(method, attributes: "userName,id", filter: filter.join(" or "))
end
public
@@ -212,6 +212,11 @@ module CF::UAA
Cli.output.string.should include("email: #{@test_user}+1@example.com")
end
+ it "gets 0 ids for a non-user" do
+ Cli.run("user ids #{@test_user}-NOT").should_not be_nil
+ Cli.output.string.should match(/^\s*$/)
+ end
+
it "should get ids for a username" do
Cli.run("user ids #{@test_user}").should_not be_nil
Cli.output.string.should match(/#{@test_user}/i)

0 comments on commit 8b26438

Please sign in to comment.