You are here

public function SecureSiteScriptDigestMD5UnitTest::testSecureSiteScriptDigestMD5Unstored in Secure Site 7.2

Same name and namespace in other branches
  1. 6.2 securesite.test \SecureSiteScriptDigestMD5UnitTest::testSecureSiteScriptDigestMD5Unstored()

Check response to unstored password.

File

./securesite.test, line 321
Tests for Secure Site module.

Class

SecureSiteScriptDigestMD5UnitTest
Unit tests for digest_md5.php.

Code

public function testSecureSiteScriptDigestMD5Unstored() {
  exec("{$this->stored_passwords} realm=" . escapeshellarg($this->realm) . ' op=delete');
  $ha1 = md5($this->user->name . ':' . $this->challenge['realm'] . ':' . $this->user->pass_raw);
  $response = md5($ha1 . ':' . $this->challenge['nonce'] . ':' . md5('GET:/'));
  $this->data[] = 'nonce="' . $this->challenge['nonce'] . '"';
  $this->data[] = 'response="' . $response . '"';
  $command = $this->digest_md5 . ' data=' . escapeshellarg(implode(', ', $this->data)) . ' method=GET';
  module_load_include('inc', 'securesite');
  $authentication = _securesite_parse_directives(exec($command, $output, $status));
  $this
    ->assertTrue($status == 2 && isset($authentication['realm']) && isset($authentication['nonce']), t('Checking response to unstored password.'));
}