@@ -1,31 +1,38 | |||||
1 | require File.expand_path('../../../test_helper', __FILE__) |
|
1 | require File.expand_path('../../../test_helper', __FILE__) | |
2 |
|
2 | |||
3 | class ApiTest::HttpBasicLoginTest < ActionController::IntegrationTest |
|
3 | class ApiTest::HttpBasicLoginTest < 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 | setup do |
|
25 | setup do | |
19 | project = Project.find('onlinestore') |
|
26 | project = Project.find('onlinestore') | |
20 | EnabledModule.create(:project => project, :name => 'news') |
|
27 | EnabledModule.create(:project => project, :name => 'news') | |
21 | end |
|
28 | end | |
22 |
|
29 | |||
23 | context "in :xml format" do |
|
30 | context "in :xml format" do | |
24 | should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.xml") |
|
31 | should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.xml") | |
25 | end |
|
32 | end | |
26 |
|
33 | |||
27 | context "in :json format" do |
|
34 | context "in :json format" do | |
28 | should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.json") |
|
35 | should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.json") | |
29 | end |
|
36 | end | |
30 | end |
|
37 | end | |
31 | end |
|
38 | end |
General Comments 0
You need to be logged in to leave comments.
Login now