You are here

function SecureSiteTest::testLoginUnprivileged in Secure Site 5

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

Check that unprivileged users don't get HTTP Auth when accessing unsecured pages

File

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

Class

SecureSiteTest
Unit tests for the Secure Site module

Code

function testLoginUnprivileged() {
  $unprivileged_user = $this
    ->drupalCreateUserRolePerm(array(
    'access content',
  ));
  $this
    ->drupalVariableSet('securesite_enabled', SECURESITE_AUTH);
  $this
    ->drupalVariableSet('securesite_filter_pages_type', SECURESITE_BLACKLIST);
  $this
    ->drupalVariableSet('securesite_filter_pages', 'admin');
  $this
    ->drupalGet(url(NULL, NULL, NULL, TRUE));
  $this
    ->assertResponse('200', t('Login: Unprivileged unsecured') . ': %s');
  $this
    ->assertNoAuthentication();
  $this
    ->assertText('User login');
  $this
    ->drupalLoginUser($unprivileged_user);
  $this
    ->assertResponse('200');
  $this
    ->assertNoAuthentication();
  $this
    ->assertNoText('User login');
}