To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / test / integration / api_test / .svn / text-base / token_authentication_test.rb.svn-base @ 441:cbce1fd3b1b7
History | View | Annotate | Download (611 Bytes)
| 1 |
require File.expand_path('../../../test_helper', __FILE__)
|
|---|---|
| 2 |
|
| 3 |
class ApiTest::TokenAuthenticationTest < 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 |
context "in :xml format" do |
| 19 |
should_allow_key_based_auth(:get, "/news.xml") |
| 20 |
end |
| 21 |
|
| 22 |
context "in :json format" do |
| 23 |
should_allow_key_based_auth(:get, "/news.json") |
| 24 |
end |
| 25 |
end |
| 26 |
end |