Skip to content

Commit

Permalink
[api] mount the webui engine as /
Browse files Browse the repository at this point in the history
- the default mimetype is application/xml if no Accept was given
- everything not default and not XML will go to the webui engine
- the rest stays in API

(remove HTML namespace as unused and all_routes_test because it's
just hiding missing coverage)
  • Loading branch information
coolo committed Oct 22, 2013
1 parent 832f9e8 commit 7ebdaf2
Show file tree
Hide file tree
Showing 25 changed files with 41 additions and 298 deletions.
1 change: 0 additions & 1 deletion src/api/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ group :assets do
gem 'sprite-factory', '>= 1.5.2'
gem 'chunky_png'

gem "bootstrap-sass"
gem 'jquery-rails'
gem 'jquery-ui-rails'
end
Expand Down
3 changes: 0 additions & 3 deletions src/api/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ GEM
addressable (2.3.5)
arel (4.0.0)
atomic (1.1.14)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
builder (3.1.4)
capybara (2.0.3)
mime-types (>= 1.16)
Expand Down Expand Up @@ -222,7 +220,6 @@ PLATFORMS

DEPENDENCIES
actionmailer
bootstrap-sass
capybara (~> 2.0.1)
capybara-webkit (< 1.0)
capybara_minitest_spec
Expand Down
2 changes: 0 additions & 2 deletions src/api/app/assets/javascripts/html/main.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/api/app/assets/stylesheets/html/main.css.scss

This file was deleted.

6 changes: 0 additions & 6 deletions src/api/app/controllers/html/main_controller.rb

This file was deleted.

4 changes: 4 additions & 0 deletions src/api/app/controllers/person_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def command
raise UnknownCommandError.new "Allowed commands are 'change_password'"
end

def login
render_ok # just a dummy check for the webui to call (for now)
end

def userinfo
login = params[:login]
user = User.find_by_login(login) if login
Expand Down
2 changes: 0 additions & 2 deletions src/api/app/helpers/html/main_helper.rb

This file was deleted.

5 changes: 0 additions & 5 deletions src/api/app/views/html/main/index.html.erb

This file was deleted.

26 changes: 0 additions & 26 deletions src/api/app/views/layouts/application.html.erb

This file was deleted.

1 change: 1 addition & 0 deletions src/api/config/initializers/wrap_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def call(env)
env["action_dispatch.request.request_parameters"] = params
end

env['HTTP_ACCEPT'] ||= 'application/xml'
@app.call(env)
end

Expand Down
12 changes: 2 additions & 10 deletions src/api/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
OBSApi::Application.routes.draw do

mount Webui::Engine, at: "/webui2", as: 'webui_engine'

scope constraints: { format: 'html' } do
namespace :html do
get '/' => 'main#index'
end
end

defaults :format => 'xml' do
mount Webui::Engine, at: '/', as: 'webui_engine'

get '/' => 'main#index'

Expand All @@ -20,6 +12,7 @@
### /person
post 'person' => 'person#command'
get 'person' => 'person#show'
post 'person/login/:user' => 'person#login'

# FIXME3.0: this is no clean namespace, a person "register" or "changepasswd" could exist ...
# remove these for OBS 3.0
Expand Down Expand Up @@ -328,5 +321,4 @@

get '/404' => 'main#notfound'

end
end
7 changes: 0 additions & 7 deletions src/api/test/controllers/html/main_controller_test.rb

This file was deleted.

4 changes: 0 additions & 4 deletions src/api/test/functional/configurations_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ def test_show_and_update_configuration
put '/configuration', config
assert_response 403 # Normal users can't change site-wide configuration

# the webui calls that
get '/configuration.json'
assert_response :success

login_king # User with admin rights
# webui is using this way to store data
put '/configuration?title=openSUSE&description=blah_fasel&name=obsname'
Expand Down
191 changes: 0 additions & 191 deletions src/api/test/functional/webui/all_routes_test.rb

This file was deleted.

10 changes: 5 additions & 5 deletions src/api/test/functional/webui/package_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def fill_comment

test 'succesful comment creation' do
login_Iggy
visit '/webui2/package/show/home:Iggy/TestPack'
visit webui_engine.root_path + '/package/show/home:Iggy/TestPack'
fill_comment
end

test 'another succesful comment creation' do
login_Iggy
visit '/webui2/package/show?project=home:Iggy&package=TestPack'
visit webui_engine.root_path + '/package/show?project=home:Iggy&package=TestPack'
fill_comment
end

Expand All @@ -86,20 +86,20 @@ def fill_comment

test 'succesful reply comment creation' do
login_Iggy
visit '/webui2/package/show/BaseDistro3/pack2'
visit webui_engine.root_path + '/package/show/BaseDistro3/pack2'
find(:id,'reply_link_id_201').click
fill_in 'reply_body_201', with: 'Comment Body'
find(:id,'add_reply_201').click
find('#flash-messages').must_have_text 'Comment added successfully '
end

test 'diff is empty' do
visit '/webui2/package/rdiff/BaseDistro2.0/pack2.linked?opackage=pack2&oproject=BaseDistro2.0'
visit webui_engine.root_path + '/package/rdiff/BaseDistro2.0/pack2.linked?opackage=pack2&oproject=BaseDistro2.0'
find('#content').must_have_text 'No source changes!'
end

test 'revision is mepty' do
visit '/webui2/package/rdiff/BaseDistro2.0/pack2.linked?opackage=pack2&oproject=BaseDistro2.0&rev='
visit webui_engine.root_path + '/package/rdiff/BaseDistro2.0/pack2.linked?opackage=pack2&oproject=BaseDistro2.0&rev='
flash_message_type.must_equal :alert
flash_message.must_equal 'revision is empty'
end
Expand Down

0 comments on commit 7ebdaf2

Please sign in to comment.