http_basic_login_test.rb
38 lines
| 1.1 KiB
| text/x-ruby
|
RubyLexer
|
r4395 | require File.expand_path('../../../test_helper', __FILE__) | ||
|
r3105 | |||
|
r4243 | class ApiTest::HttpBasicLoginTest < ActionController::IntegrationTest | ||
|
r7396 | fixtures :projects, :trackers, :issue_statuses, :issues, | ||
:enumerations, :users, :issue_categories, | ||||
:projects_trackers, | ||||
:roles, | ||||
:member_roles, | ||||
:members, | ||||
:enabled_modules, | ||||
:workflows | ||||
|
r3105 | |||
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 | ||||
|
r6550 | |||
|
r3105 | # 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 | ||||