You are here

public function TfaTestCase::testPluginFloodControl in Two-factor Authentication (TFA) 7.2

Test plugin flood control.

File

tests/tfa.test, line 167
Drupal test cases for TFA.

Class

TfaTestCase
Tests the functionality of the TFA module.

Code

public function testPluginFloodControl() {
  variable_set('tfa_validate_plugin', 'tfa_test_send');
  $account = $this->web_user;
  variable_set('tfa_test_resend_threshold', 1);
  $edit = array(
    'name' => $account->name,
    'pass' => $account->pass_raw,
  );
  $this
    ->drupalPost('user/login', $edit, 'Log in');
  $url_parts = explode('/', $this->url);
  $login_hash = array_pop($url_parts);
  $this
    ->drupalPost('system/tfa/' . $account->uid . '/' . $login_hash, array(), 'Resend');
  $this
    ->assertText('Resend flood hit', 'The resend flood text appears');
}