Commit 7c8b7da7b26d633146bf032a62afd17a76948b46
1 parent
08581a0c
Exists in
master
and in
27 other branches
Move session/cookie test to HTTP caching tests
Showing
3 changed files
with
6 additions
and
45 deletions
Show diff stats
features/session_and_cookies_handling.feature
| @@ -1,40 +0,0 @@ | @@ -1,40 +0,0 @@ | ||
| 1 | -Feature: session and cookies handling | ||
| 2 | - | ||
| 3 | - As a Noosfero system administrator | ||
| 4 | - I want Noosfero to manage well it usage of sessions and cookies | ||
| 5 | - So that we can use HTTP caching effectively | ||
| 6 | - | ||
| 7 | - @fixme | ||
| 8 | - Scenario: home page, logged in | ||
| 9 | - Given the following users | ||
| 10 | - | login | | ||
| 11 | - | joaosilva | | ||
| 12 | - When I am logged in as "joaosilva" | ||
| 13 | - And I go to the homepage | ||
| 14 | - Then there must be a cookie "_noosfero_session" | ||
| 15 | - | ||
| 16 | - Scenario: home page, not logged in | ||
| 17 | - When I go to the homepage | ||
| 18 | - Then there must be no cookies | ||
| 19 | - | ||
| 20 | - @fixme | ||
| 21 | - Scenario: user_data, not logged in | ||
| 22 | - When I make a AJAX request to the user data path | ||
| 23 | - Then there must be no cookies | ||
| 24 | - | ||
| 25 | - @fixme | ||
| 26 | - Scenario: user_data, logged in | ||
| 27 | - Given I am logged in as admin | ||
| 28 | - When I make a AJAX request to the user data path | ||
| 29 | - Then there must be a cookie "_noosfero_session" | ||
| 30 | - | ||
| 31 | - # FIXME for some reason I could not test this scenario, although manual tests | ||
| 32 | - # indicate this works! | ||
| 33 | - # Scenario: logout | ||
| 34 | - # Given the following users | ||
| 35 | - # | login | | ||
| 36 | - # | joao | | ||
| 37 | - # When I am logged in as "joao" | ||
| 38 | - # And I log off | ||
| 39 | - # And I go to the homepage | ||
| 40 | - # Then there must be no cookies |
features/step_definitions/noosfero_steps.rb
| @@ -692,11 +692,6 @@ Given /^the cache is turned (on|off)$/ do |state| | @@ -692,11 +692,6 @@ Given /^the cache is turned (on|off)$/ do |state| | ||
| 692 | ActionController::Base.perform_caching = (state == 'on') | 692 | ActionController::Base.perform_caching = (state == 'on') |
| 693 | end | 693 | end |
| 694 | 694 | ||
| 695 | -When /^I make a AJAX request to (.*)$/ do |page| | ||
| 696 | - header 'X-Requested-With', 'XMLHttpRequest' | ||
| 697 | - visit(path_to(page)) | ||
| 698 | -end | ||
| 699 | - | ||
| 700 | Given /^the environment is configured to (.*) after login$/ do |option| | 695 | Given /^the environment is configured to (.*) after login$/ do |option| |
| 701 | redirection = case option | 696 | redirection = case option |
| 702 | when 'stay on the same page' | 697 | when 'stay on the same page' |
test/integration/http_caching_test.rb
| @@ -9,6 +9,7 @@ class HttpCachingTest < ActionController::IntegrationTest | @@ -9,6 +9,7 @@ class HttpCachingTest < ActionController::IntegrationTest | ||
| 9 | test 'home page, default configuration' do | 9 | test 'home page, default configuration' do |
| 10 | get '/' | 10 | get '/' |
| 11 | assert_cache(5.minutes) | 11 | assert_cache(5.minutes) |
| 12 | + assert_no_cookies | ||
| 12 | end | 13 | end |
| 13 | 14 | ||
| 14 | test 'home page, custom config' do | 15 | test 'home page, custom config' do |
| @@ -91,6 +92,11 @@ class HttpCachingTest < ActionController::IntegrationTest | @@ -91,6 +92,11 @@ class HttpCachingTest < ActionController::IntegrationTest | ||
| 91 | assert_no_cache | 92 | assert_no_cache |
| 92 | end | 93 | end |
| 93 | 94 | ||
| 95 | + test 'user data, not logged in' do | ||
| 96 | + get '/account/user_data', {}, { 'X-Requested-With' => 'XMLHttpRequest'} | ||
| 97 | + assert_no_cookies | ||
| 98 | + end | ||
| 99 | + | ||
| 94 | protected | 100 | protected |
| 95 | 101 | ||
| 96 | def set_env_config(data) | 102 | def set_env_config(data) |