summaryrefslogtreecommitdiff
path: root/modules/openid
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-10-08 05:28:30 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-10-08 05:28:30 +0000
commit17d30dc3a37c9eb524d601a34004efc92322d984 (patch)
tree358b7a174bddabb28856dfb2063b496561f253be /modules/openid
parent44c2bfdcd1ec8e309ad05c2d681d5d3755adecea (diff)
downloadbrdo-17d30dc3a37c9eb524d601a34004efc92322d984.tar.gz
brdo-17d30dc3a37c9eb524d601a34004efc92322d984.tar.bz2
#925778 by mradcliffe, chx, sun, manarth: Fixed user edit title incorrectly shows currently logged in user.
Diffstat (limited to 'modules/openid')
-rw-r--r--modules/openid/openid.test33
1 files changed, 23 insertions, 10 deletions
diff --git a/modules/openid/openid.test b/modules/openid/openid.test
index 8937576c7..9fe888b45 100644
--- a/modules/openid/openid.test
+++ b/modules/openid/openid.test
@@ -20,6 +20,16 @@ abstract class OpenIDWebTestCase extends DrupalWebTestCase {
// Submit form to the OpenID Provider Endpoint.
$this->drupalPost(NULL, array(), t('Send'));
}
+
+ /**
+ * Parses the last sent e-mail and returns the one-time login link URL.
+ */
+ function getPasswordResetURLFromMail() {
+ $mails = $this->drupalGetMails();
+ $mail = end($mails);
+ preg_match('@.+user/reset/.+@', $mail['body'], $matches);
+ return $matches[0];
+ }
}
/**
@@ -126,7 +136,7 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
// Test logging in via the login block on the front page.
$this->submitLoginForm($identity);
- $this->assertLink($this->web_user->name, 0, t('User was logged in.'));
+ $this->assertLink(t('Log out'), 0, t('User was logged in.'));
$this->drupalLogout();
@@ -140,7 +150,7 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
// Submit form to the OpenID Provider Endpoint.
$this->drupalPost(NULL, array(), t('Send'));
- $this->assertLink($this->web_user->name, 0, t('User was logged in.'));
+ $this->assertLink(t('Log out'), 0, t('User was logged in.'));
// Verify user was redirected away from user/login to an accessible page.
$this->assertResponse(200);
@@ -171,7 +181,7 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
// Submit form to the OpenID Provider Endpoint.
$this->drupalPost(NULL, array(), t('Send'));
- $this->assertLink($this->web_user->name, 0, t('User was logged in.'));
+ $this->assertLink(t('Log out'), 0, t('User was logged in.'));
// Verify user was redirected away from user/login to an accessible page.
$this->assertText(t('Operating in maintenance mode.'));
@@ -316,6 +326,7 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
$this->submitLoginForm($identity);
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
$this->assertRaw(t('A welcome message with further instructions has been sent to your e-mail address.'), t('A welcome message was sent to the user.'));
+ $reset_url = $this->getPasswordResetURLFromMail();
$user = user_load_by_name('john');
$this->assertTrue($user, t('User was registered with right username.'));
@@ -326,14 +337,14 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
$this->assertRaw(t('You must validate your email address for this account before logging in via OpenID.'));
// Follow the one-time login that was sent in the welcome e-mail.
- $this->drupalGet(user_pass_reset_url($user));
+ $this->drupalGet($reset_url);
$this->drupalPost(NULL, array(), t('Log in'));
$this->drupalLogout();
// Verify that the account was activated.
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, t('User was logged in.'));
+ $this->assertLink(t('Log out'), 0, t('User was logged in.'));
}
/**
@@ -348,7 +359,7 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
// Use a User-supplied Identity that is the URL of an XRDS document.
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, t('User was logged in.'));
+ $this->assertLink(t('Log out'), 0, t('User was logged in.'));
$user = user_load_by_name('john');
$this->assertTrue($user, t('User was registered with right username.'));
@@ -358,7 +369,7 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
$this->drupalLogout();
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, t('User was logged in.'));
+ $this->assertLink(t('Log out'), 0, t('User was logged in.'));
}
/**
@@ -382,13 +393,14 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
$edit = array('name' => 'john', 'mail' => 'john@example.com');
$this->drupalPost(NULL, $edit, t('Create new account'));
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
+ $reset_url = $this->getPasswordResetURLFromMail();
$user = user_load_by_name('john');
$this->assertTrue($user, t('User was registered with right username.'));
$this->assertFalse($user->data, t('No additional user info was saved.'));
// Follow the one-time login that was sent in the welcome e-mail.
- $this->drupalGet(user_pass_reset_url($user));
+ $this->drupalGet($reset_url);
$this->drupalPost(NULL, array(), t('Log in'));
// The user is taken to user/%uid/edit.
@@ -417,13 +429,14 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
$edit = array('name' => 'john', 'mail' => 'john@example.com');
$this->drupalPost(NULL, $edit, t('Create new account'));
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
+ $reset_url = $this->getPasswordResetURLFromMail();
$user = user_load_by_name('john');
$this->assertTrue($user, t('User was registered with right username.'));
$this->assertFalse($user->data, t('No additional user info was saved.'));
// Follow the one-time login that was sent in the welcome e-mail.
- $this->drupalGet(user_pass_reset_url($user));
+ $this->drupalGet($reset_url);
$this->drupalPost(NULL, array(), t('Log in'));
// The user is taken to user/%uid/edit.
@@ -453,7 +466,7 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
// Use a User-supplied Identity that is the URL of an XRDS document.
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, t('User was logged in.'));
+ $this->assertLink(t('Log out'), 0, t('User was logged in.'));
$user = user_load_by_name('john');
$this->assertTrue($user, t('User was registered with right username.'));