token_authentication_test.rb
33 lines
| 853 B
| text/x-ruby
|
RubyLexer
|
r4395 | require File.expand_path('../../../test_helper', __FILE__) | ||
|
r3104 | |||
|
r4243 | class ApiTest::TokenAuthenticationTest < ActionController::IntegrationTest | ||
|
r7398 | fixtures :projects, :trackers, :issue_statuses, :issues, | ||
:enumerations, :users, :issue_categories, | ||||
:projects_trackers, | ||||
:roles, | ||||
:member_roles, | ||||
:members, | ||||
:enabled_modules, | ||||
:workflows | ||||
|
r3104 | |||
|
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 | ||||
|
r6551 | |||
|
r3104 | # Using the NewsController because it's a simple API. | ||
|
r3105 | context "get /news" do | ||
|
r3104 | context "in :xml format" do | ||
|
r4244 | should_allow_key_based_auth(:get, "/news.xml") | ||
|
r3104 | end | ||
context "in :json format" do | ||||
|
r4244 | should_allow_key_based_auth(:get, "/news.json") | ||
|
r3104 | end | ||
end | ||||
end | ||||