You are here

function SecureSiteTest::testLogoutRedirect in Secure Site 6

Same name and namespace in other branches
  1. 5 tests/securesite.test \SecureSiteTest::testLogoutRedirect()

Check that the user doesn't get stuck on the logout page

File

tests/securesite.test, line 742
Secure Site module unit tests

Class

SecureSiteTest
Unit tests for the Secure Site module

Code

function testLogoutRedirect() {
  $realm = variable_get('securesite_realm', variable_get('site_name', 'Drupal'));
  $privileged_user = $this
    ->drupalCreateUserRolePerm(array(
    'access content',
    'access secured pages',
  ));
  $this
    ->drupalVariableSet('securesite_enabled', SECURESITE_AUTH);
  $this
    ->drupalVariableSet('securesite_filter_pages_type', SECURESITE_WHITELIST);
  $this
    ->drupalVariableSet('securesite_filter_pages', '');
  $this
    ->drupalGet(url(NULL, array(
    'absolute' => TRUE,
  )));
  $this
    ->assertResponse('401', t('Logout Redirect') . ': %s');
  $this
    ->assertAuthentication('Basic');
  $this
    ->assertRealm($realm);
  $this
    ->authenticate($privileged_user->name, $privileged_user->pass_raw);
  $this
    ->assertResponse('200');
  $this
    ->assertNoAuthentication();
  $this
    ->drupalGet(url('logout', array(
    'absolute' => TRUE,
  )));
  $this
    ->assertResponse('401');
  $this
    ->assertAuthentication('Basic');
  $this
    ->assertRealm($realm);
  $this
    ->authenticate($privileged_user->name, $privileged_user->pass_raw);
  $this
    ->assertResponse('200');
  $this
    ->assertNoAuthentication();
}