You are here

public function SecKitTestCase::testOriginAllowsSpecifiedSource in Security Kit 7

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

Tests HTTP Origin allows requests from the specified source.

File

./seckit.test, line 394
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/config/system/seckit', $form, t('Save configuration'));
  $this
    ->drupalPost('admin/config/system/seckit', $form, t('Save configuration'), array(), array(
    'Origin: http://www.example.com',
  ));
  $this
    ->assertResponse(200, t('Whitelisted request is allowed.'));
}