To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / test / integration / api_test / .svn / text-base / http_basic_login_test.rb.svn-base @ 441:cbce1fd3b1b7

History | View | Annotate | Download (835 Bytes)

1
require File.expand_path('../../../test_helper', __FILE__)
2

    
3
class ApiTest::HttpBasicLoginTest < ActionController::IntegrationTest
4
  fixtures :all
5

    
6
  def setup
7
    Setting.rest_api_enabled = '1'
8
    Setting.login_required = '1'
9
  end
10

    
11
  def teardown
12
    Setting.rest_api_enabled = '0'
13
    Setting.login_required = '0'
14
  end
15
  
16
  # Using the NewsController because it's a simple API.
17
  context "get /news" do
18
    setup do
19
      project = Project.find('onlinestore')
20
      EnabledModule.create(:project => project, :name => 'news')
21
    end
22

    
23
    context "in :xml format" do
24
      should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.xml")
25
    end
26

    
27
    context "in :json format" do
28
      should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.json")
29
    end
30
  end
31
end