OpenIDFunctionalTestCase::testBlockedUserLogin

7 openid.test OpenIDFunctionalTestCase::testBlockedUserLogin()
8 openid.test OpenIDFunctionalTestCase::testBlockedUserLogin()

Test that a blocked user cannot log in.

File

modules/openid/openid.test, line 239
Tests for openid.module.

Code

function testBlockedUserLogin() {
  // Use a User-supplied Identity that is the URL of an XRDS document.
  $identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));

  // Log in and add an OpenID Identity to the account.
  $this->drupalLogin($this->web_user);
  $this->addIdentity($identity);
  $this->drupalLogout();

  // Log in as an admin user and block the account.
  $admin_user = $this->drupalCreateUser(array('administer users'));
  $this->drupalLogin($admin_user);
  $this->drupalGet('admin/people');
  $edit = array(
    'operation' => 'block', 
    'accounts[' . $this->web_user->uid . ']' => TRUE,
  );
  $this->drupalPost('admin/people', $edit, t('Update'));
  $this->assertRaw('The update has been performed.', t('Account was blocked.'));
  $this->drupalLogout();

  $this->submitLoginForm($identity);
  $this->assertRaw(t('The username %name has not been activated or is blocked.', array('%name' => $this->web_user->name)), t('User login was blocked.'));
}
Login or register to post comments