@@ -1,26 +1,33 | |||||
1 | require File.expand_path('../../../test_helper', __FILE__) |
|
1 | require File.expand_path('../../../test_helper', __FILE__) | |
2 |
|
2 | |||
3 | class ApiTest::TokenAuthenticationTest < ActionController::IntegrationTest |
|
3 | class ApiTest::TokenAuthenticationTest < ActionController::IntegrationTest | |
4 | fixtures :all |
|
4 | fixtures :projects, :trackers, :issue_statuses, :issues, | |
|
5 | :enumerations, :users, :issue_categories, | |||
|
6 | :projects_trackers, | |||
|
7 | :roles, | |||
|
8 | :member_roles, | |||
|
9 | :members, | |||
|
10 | :enabled_modules, | |||
|
11 | :workflows | |||
5 |
|
12 | |||
6 | def setup |
|
13 | def setup | |
7 | Setting.rest_api_enabled = '1' |
|
14 | Setting.rest_api_enabled = '1' | |
8 | Setting.login_required = '1' |
|
15 | Setting.login_required = '1' | |
9 | end |
|
16 | end | |
10 |
|
17 | |||
11 | def teardown |
|
18 | def teardown | |
12 | Setting.rest_api_enabled = '0' |
|
19 | Setting.rest_api_enabled = '0' | |
13 | Setting.login_required = '0' |
|
20 | Setting.login_required = '0' | |
14 | end |
|
21 | end | |
15 |
|
22 | |||
16 | # Using the NewsController because it's a simple API. |
|
23 | # Using the NewsController because it's a simple API. | |
17 | context "get /news" do |
|
24 | context "get /news" do | |
18 | context "in :xml format" do |
|
25 | context "in :xml format" do | |
19 | should_allow_key_based_auth(:get, "/news.xml") |
|
26 | should_allow_key_based_auth(:get, "/news.xml") | |
20 | end |
|
27 | end | |
21 |
|
28 | |||
22 | context "in :json format" do |
|
29 | context "in :json format" do | |
23 | should_allow_key_based_auth(:get, "/news.json") |
|
30 | should_allow_key_based_auth(:get, "/news.json") | |
24 | end |
|
31 | end | |
25 | end |
|
32 | end | |
26 | end |
|
33 | end |
General Comments 0
You need to be logged in to leave comments.
Login now