Skip to content

Commit

Permalink
[api] fix test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Dec 21, 2012
1 parent 164f9ec commit ea95ded
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/app/controllers/public_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def lastevents
# GET /public/distributions
def distributions
valid_http_methods :get
@distributions = Distribution.all
@distributions = Distribution.all_as_hash

render "distributions/index"
end
Expand Down
1 change: 1 addition & 0 deletions src/api/lib/opensuse/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def start_test_backend
logger.debug line.strip
end
CONFIG['global_write_through'] = true
WebMock.disable_net_connect!(allow: CONFIG['source_host'])
at_exit do
logger.debug "kill #{@@backend.pid}"
Process.kill "INT", @@backend.pid
Expand Down
5 changes: 5 additions & 0 deletions src/api/test/functional/distributions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ class DistributionsControllerTest < ActionController::IntegrationTest
get "/distributions"
assert_response :success
assert_no_xml_tag :tag => "project", :content => "RemoteInstance:openSUSE:12.2"
end

test "remotes work" do
prepare_request_with_user "tom", "thunder"

fake_distribution_body = File.open(Rails.root.join("test/fixtures/backend/distributions.xml")).read

# using mocha has the disadvantage of not testing the complete function
Expand All @@ -87,6 +91,7 @@ class DistributionsControllerTest < ActionController::IntegrationTest

end


test "we survive remote instances timeouts" do
stub_request(:get, "http://localhost:3200/distributions.xml").to_timeout
get "/distributions/include_remotes"
Expand Down

0 comments on commit ea95ded

Please sign in to comment.