You are here

function SecureSiteTest::testUserAgentFirefox in Secure Site 5

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

Check that the realm is correct when using the HTTP Auth method with Firefox's User Agent string

File

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

Class

SecureSiteTest
Unit tests for the Secure Site module

Code

function testUserAgentFirefox() {
  $realm = variable_get('securesite_realm', variable_get('site_name', 'Drupal'));

  // Send the Firefox 3.0.1 User-Agent header
  $this
    ->restart();
  $this
    ->drupalVariableSet('securesite_enabled', SECURESITE_AUTH);
  $this
    ->drupalVariableSet('securesite_filter_pages_type', SECURESITE_WHITELIST);
  $this
    ->drupalVariableSet('securesite_filter_pages', '');
  $this
    ->addHeader('User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1');
  $this
    ->drupalGet(url(NULL, NULL, NULL, TRUE));
  $this
    ->assertResponse('401', t('User Agent: Firefox') . ': %s');
  $this
    ->assertAuthentication('Basic');
  $this
    ->assertRealm($realm);
}