You are here

public function SecKitTestCase::testOriginAllowsSpecifiedSource in Security Kit 6

Same name and namespace in other branches
  1. 7 seckit.test \SecKitTestCase::testOriginAllowsSpecifiedSource()

Tests HTTP Origin allows requests from the specified source.

File

./seckit.test, line 219
Tests for Security Kit module.

Class

SecKitTestCase
Functional tests for Security Kit.

Code

public function testOriginAllowsSpecifiedSource() {
  $form = array(
    'seckit_csrf[origin]' => TRUE,
    'seckit_csrf[origin_whitelist]' => 'http://www.example.com',
  );
  $this
    ->drupalPost('admin/settings/seckit', $form, t('Save configuration'));
  $this
    ->drupalPost('admin/settings/seckit', $form, t('Save configuration'), array(), array(
    'Origin: http://www.example.com',
  ));
  $this
    ->assertResponse(200, t('Whitelisted request is allowed.'));
}