chris@37: require "#{File.dirname(__FILE__)}/../../test_helper" chris@37: chris@37: class ApiTest::HttpBasicLoginTest < ActionController::IntegrationTest chris@37: fixtures :all chris@37: chris@37: def setup chris@37: Setting.rest_api_enabled = '1' chris@37: Setting.login_required = '1' chris@37: end chris@37: chris@37: def teardown chris@37: Setting.rest_api_enabled = '0' chris@37: Setting.login_required = '0' chris@37: end chris@37: chris@37: # Using the NewsController because it's a simple API. chris@37: context "get /news" do chris@37: setup do chris@37: project = Project.find('onlinestore') chris@37: EnabledModule.create(:project => project, :name => 'news') chris@37: end chris@37: chris@37: context "in :xml format" do chris@37: should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.xml") chris@37: end chris@37: chris@37: context "in :json format" do chris@37: should_allow_http_basic_auth_with_username_and_password(:get, "/projects/onlinestore/news.json") chris@37: end chris@37: end chris@37: end