You are here

public function JsTestWebTestCase::testAuthentication in JS Callback Handler 7

Test authentication.

File

tests/js_test.test, line 63
Testing for the bam template module

Class

JsTestWebTestCase
@file Testing for the bam template module

Code

public function testAuthentication() {
  $this->privileged_user = $this
    ->drupalCreateUser(array(
    'js test permission',
  ));
  $this
    ->drupalLogin($this->privileged_user);

  // Via clean url (rewrite).
  $out = $this
    ->drupalGet('js/js_test/test_basic_access');
  $out = drupal_json_decode($out);
  $this
    ->assertEqual($out['response'], 'ok', 'Should have permission to view this page.');

  // Via clean url (rewrite).
  $this
    ->drupalGet('js/js_test/test_basic_access_failure');
  $headers = $this
    ->drupalGetHeaders();
  $this
    ->assertResponse('403', 'Should NOT have permission to view this page.');
}