http_basic_login_test.rb
31 lines
| 830 B
| text/x-ruby
|
RubyLexer
|
r4243 | require "#{File.dirname(__FILE__)}/../../test_helper" | ||
|
r3105 | |||
|
r4243 | class ApiTest::HttpBasicLoginTest < ActionController::IntegrationTest | ||
|
r3105 | fixtures :all | ||
def setup | ||||
|
r3106 | Setting.rest_api_enabled = '1' | ||
|
r3105 | Setting.login_required = '1' | ||
end | ||||
def teardown | ||||
|
r3106 | Setting.rest_api_enabled = '0' | ||
|
r3105 | Setting.login_required = '0' | ||
end | ||||
# Using the NewsController because it's a simple API. | ||||
context "get /news" do | ||||
|
r4246 | setup do | ||
project = Project.find('onlinestore') | ||||
EnabledModule.create(:project => project, :name => 'news') | ||||
end | ||||
|
r3105 | |||
context "in :xml format" do | ||||
|
r4246 | should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.xml") | ||
|
r3105 | end | ||
context "in :json format" do | ||||
|
r4246 | should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.json") | ||
|
r3565 | end | ||
|
r3105 | end | ||
end | ||||