Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
Update tests to use testmail accounts for email (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
bretterer authored Dec 17, 2016
1 parent 80bef07 commit b67dacc
Show file tree
Hide file tree
Showing 20 changed files with 109 additions and 105 deletions.
2 changes: 1 addition & 1 deletion tests/Authc/Api/ApiRequestAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function setUpBeforeClass()
'middleName' => 'ApiRequestAuthenticatorTest',
'surname' => 'Test',
'username' => makeUniqueName('ApiRequestAuthenticatorTest'),
'email' => makeUniqueName('ApiRequestAuthenticatorTest') .'@unknown123.kot',
'email' => makeUniqueName('ApiRequestAuthenticatorTest') .'@testmail.stormpath.com',
'password' => 'superP4ss'

)
Expand Down
2 changes: 1 addition & 1 deletion tests/Authc/Api/BasicRequestAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function setUpBeforeClass()
'middleName' => 'BasicRequestAuthenticatorTest',
'surname' => 'Test',
'username' => makeUniqueName('BasicRequestAuthenticatorTest'),
'email' => makeUniqueName('BasicRequestAuthenticatorTest') .'@unknown123.kot',
'email' => makeUniqueName('BasicRequestAuthenticatorTest') .'@testmail.stormpath.com',
'password' => 'superP4ss'

)
Expand Down
2 changes: 1 addition & 1 deletion tests/Authc/Api/OAuthBearerRequestAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function setUpBeforeClass()
'middleName' => 'OAuthBearerRequestAuthenticatorTest',
'surname' => 'Test',
'username' => makeUniqueName('OAuthBearerRequestAuthenticatorTest'),
'email' => makeUniqueName('OAuthBearerRequestAuthenticatorTest') .'@unknown123.kot',
'email' => makeUniqueName('OAuthBearerRequestAuthenticatorTest') .'@testmail.stormpath.com',
'password' => 'superP4ss'

)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function setUpBeforeClass()
'middleName' => 'BasicRequestAuthenticator',
'surname' => 'Test',
'username' => makeUniqueName('OAuthClientCredentialsAuthenticationTest'),
'email' => makeUniqueName('OAuthClientCredentialsAuthenticationTest') .'@unknown123.kot',
'email' => makeUniqueName('OAuthClientCredentialsAuthenticationTest') .'@testmail.stormpath.com',
'password' => 'superP4ss'

)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function setUpBeforeClass()
'middleName' => 'BasicRequestAuthenticator',
'surname' => 'Test',
'username' => md5(time() . microtime() . uniqid()) . 'username',
'email' => md5(time() . microtime() . uniqid()) . '@unknown123.kot',
'email' => md5(time() . microtime() . uniqid()) . '@testmail.stormpath.com',
'password' => 'superP4ss'

)
Expand Down
2 changes: 1 addition & 1 deletion tests/Authc/Api/OAuthRequestAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function setUpBeforeClass()
'middleName' => 'OAuthRequestAuthenticator',
'surname' => 'Test',
'username' => makeUniqueName('OAuthRequestAuthenticatorTest'),
'email' => makeUniqueName('OAuthRequestAuthenticatorTest') .'@unknown123.kot',
'email' => makeUniqueName('OAuthRequestAuthenticatorTest') .'@testmail.stormpath.com',
'password' => 'superP4ss'

)
Expand Down
12 changes: 6 additions & 6 deletions tests/Cache/Tags/CacheTagExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public function testExtractSingleExpansionTags()
$docJson = <<<EOJ
{
"href": "https://api.stormpath.com/v1/accounts/3VuAsUL9zeBGZRtB48fVZM",
"username": "magnus+stormpathtest@fervo.se",
"email": "magnus+stormpathtest@fervo.se",
"username": "magnus+stormpathtest@testmail.stormpath.com",
"email": "magnus+stormpathtest@testmail.stormpath.com",
"givenName": "Magnus",
"middleName": null,
"surname": "Nordlander",
Expand Down Expand Up @@ -112,8 +112,8 @@ public function testExtractCollectionExpansion()
$docJson = <<<EOJ
{
"href": "https://api.stormpath.com/v1/accounts/3VuAsUL9zeBGZRtB48fVZM",
"username": "magnus+stormpathtest@fervo.se",
"email": "magnus+stormpathtest@fervo.se",
"username": "magnus+stormpathtest@testmail.stormpath.com",
"email": "magnus+stormpathtest@testmail.stormpath.com",
"givenName": "Magnus",
"middleName": null,
"surname": "Nordlander",
Expand Down Expand Up @@ -249,8 +249,8 @@ public function testExtractLimitedCollectionExpansion()
$docJson = <<<EOJ
{
"href": "https://api.stormpath.com/v1/accounts/3VuAsUL9zeBGZRtB48fVZM",
"username": "magnus+stormpathtest@fervo.se",
"email": "magnus+stormpathtest@fervo.se",
"username": "magnus+stormpathtest@testmail.stormpath.com",
"email": "magnus+stormpathtest@testmail.stormpath.com",
"givenName": "Magnus",
"middleName": null,
"surname": "Nordlander",
Expand Down
10 changes: 5 additions & 5 deletions tests/Mail/ModeledEmailTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function setUpBeforeClass()
'name' => 'My Email',
'description' => 'My Description',
'fromName' => 'John Doe',
'fromEmailAddress' => 'john.doe@email.com',
'fromEmailAddress' => 'john.doe@testmail.stormpath.com',
'subject' => 'Your Password has been changed!',
'textBody' => 'Your password has been successfully changed',
'htmlBody' => 'Your password has been <b>successfully</b> changed',
Expand Down Expand Up @@ -146,11 +146,11 @@ public function from_email_address_is_accessible()
/** @test */
public function from_email_address_is_settable()
{
static::$modeledEmailTemplate->setFromEmailAddress('john.doe.jr@example.com');
$this->assertEquals('john.doe.jr@example.com', static::$modeledEmailTemplate->getFromEmailAddress());
static::$modeledEmailTemplate->setFromEmailAddress('john.doe.jr@testmail.stormpath.com');
$this->assertEquals('john.doe.jr@testmail.stormpath.com', static::$modeledEmailTemplate->getFromEmailAddress());

static::$modeledEmailTemplate->fromEmailAddress = 'john.doe@example.com';
$this->assertEquals('john.doe@example.com', static::$modeledEmailTemplate->getFromEmailAddress());
static::$modeledEmailTemplate->fromEmailAddress = 'john.doe@testmail.stormpath.com';
$this->assertEquals('john.doe@testmail.stormpath.com', static::$modeledEmailTemplate->getFromEmailAddress());
}

/** @test */
Expand Down
10 changes: 5 additions & 5 deletions tests/Mail/UnmodeledEmailTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function setUpBeforeClass()
'name' => 'My Email',
'description' => 'My Description',
'fromName' => 'John Doe',
'fromEmailAddress' => 'john.doe@email.com',
'fromEmailAddress' => 'john.doe@testmail.stormpath.com',
'subject' => 'Your Password has been changed!',
'textBody' => 'Your password has been successfully changed',
'htmlBody' => 'Your password has been <b>successfully</b> changed',
Expand Down Expand Up @@ -143,11 +143,11 @@ public function from_email_address_is_accessible()
/** @test */
public function from_email_address_is_settable()
{
static::$modeledEmailTemplate->setFromEmailAddress('john.doe.jr@example.com');
$this->assertEquals('john.doe.jr@example.com', static::$modeledEmailTemplate->getFromEmailAddress());
static::$modeledEmailTemplate->setFromEmailAddress('john.doe.jr@testmail.stormpath.com');
$this->assertEquals('john.doe.jr@testmail.stormpath.com', static::$modeledEmailTemplate->getFromEmailAddress());

static::$modeledEmailTemplate->fromEmailAddress = 'john.doe@example.com';
$this->assertEquals('john.doe@example.com', static::$modeledEmailTemplate->getFromEmailAddress());
static::$modeledEmailTemplate->fromEmailAddress = 'john.doe@testmail.stormpath.com';
$this->assertEquals('john.doe@testmail.stormpath.com', static::$modeledEmailTemplate->getFromEmailAddress());
}

/** @test */
Expand Down
16 changes: 8 additions & 8 deletions tests/Mfa/GoogleAuthenticatorFactorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function setUpBeforeClass()
"accountName" => "",
"issuer" => "",
"secret" => "JBSWY3DPEHPK3PXP",
"keyUri" => "otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example", //?
"keyUri" => "otpauth://totp/Example:alice@testmail.stormpath.com?secret=JBSWY3DPEHPK3PXP&issuer=Example", //?
"base64QRImage" => "qrcode",
"account" => [
"href" => "https://api.stormpath.com/v1/accounts/3w9hThWQ3uAT46sMuWY6dw"
Expand Down Expand Up @@ -139,11 +139,11 @@ public function account_name_is_accessible()
/** @test */
public function account_name_is_settable()
{
static::$testable->setAccountName('[email protected]');
static::assertEquals('[email protected]', static::$testable->getAccountName());
static::$testable->setAccountName('support@testmail.stormpath.com');
static::assertEquals('support@testmail.stormpath.com', static::$testable->getAccountName());

static::$testable->accountName = '[email protected]';
static::assertEquals('[email protected]', static::$testable->getAccountName());
static::$testable->accountName = 'php@testmail.stormpath.com';
static::assertEquals('php@testmail.stormpath.com', static::$testable->getAccountName());
}


Expand All @@ -161,7 +161,7 @@ public function a_google_authenticator_factor_can_be_added_to_an_account()
$account = $this->setupNewAccount();

$gaFactor = new GoogleAuthenticatorFactor();
$gaFactor->accountName = '[email protected]';
$gaFactor->accountName = 'brian@testmail.stormpath.com';
$gaFactor->issuer = 'php-test';
$gaFactor->status = Stormpath::ENABLED;

Expand All @@ -172,7 +172,7 @@ public function a_google_authenticator_factor_can_be_added_to_an_account()
$this->assertNull($factor->mostRecentChallenge);
$this->assertEquals(Stormpath::ENABLED, $factor->status);
$this->assertEquals(Stormpath::UNVERIFIED, $factor->verificationStatus);
$this->assertEquals('[email protected]', $factor->accountName);
$this->assertEquals('brian@testmail.stormpath.com', $factor->accountName);
$this->assertEquals('php-test', $factor->issuer);

$account->directory->delete();
Expand All @@ -192,7 +192,7 @@ private function setupNewAccount(\Stormpath\Resource\Directory $directory = null
'middleName' => 'Middle Name',
'surname' => 'Surname',
'username' => makeUniqueName('AccountTest smsFactor') . 'username',
'email' => makeUniqueName('AccountTest smsFactor') .'@mailinator.com',
'email' => makeUniqueName('AccountTest smsFactor') .'@testmail.stormpath.com',
'password' => 'superP4ss!'
])
);
Expand Down
10 changes: 7 additions & 3 deletions tests/Mfa/Physical/SmsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,20 @@ public static function tearDownAfterClass()


}
/** @test */
public function returns_true()
{
$this->assertTrue(true);
}


/**
* @test
* @group physical
*/
public function adding_sms_factor_with_challenge_flag_send_a_text_message()
{

$smsFactor = SmsFactor::instantiate();
// $smsFactor->phone = '5133608855';
$smsFactor->challenge = 'Validate with ${code}';

$factor = self::$account->addFactor($smsFactor);
Expand All @@ -127,7 +131,7 @@ private static function setupNewAccount(\Stormpath\Resource\Directory $directory
'middleName' => 'Middle Name',
'surname' => 'Surname',
'username' => makeUniqueName('AccountTest smsFactor') . 'username',
'email' => makeUniqueName('AccountTest smsFactor') .'@mailinator.com',
'email' => makeUniqueName('AccountTest smsFactor') .'@testmail.stormpath.com',
'password' => 'superP4ss!'
])
);
Expand Down
2 changes: 1 addition & 1 deletion tests/Mfa/SmsFactorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private function setupNewAccount(\Stormpath\Resource\Directory $directory = null
'middleName' => 'Middle Name',
'surname' => 'Surname',
'username' => makeUniqueName('AccountTest smsFactor') . 'username',
'email' => makeUniqueName('AccountTest smsFactor') .'@mailinator.com',
'email' => makeUniqueName('AccountTest smsFactor') .'@testmail.stormpath.com',
'password' => 'superP4ss!'
])
);
Expand Down
2 changes: 1 addition & 1 deletion tests/Oauth/PasswordRefreshGrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected static function init()
'middleName' => 'Middle Name',
'surname' => 'Surname',
'username' => md5(time().microtime().uniqid()) . 'username',
'email' => md5(time().microtime().uniqid()) .'@unknown123.kot',
'email' => md5(time().microtime().uniqid()) .'@testmail.stormpath.com',
'password' => 'superP4ss'));

self::$application->createAccount(self::$account);
Expand Down
Loading

0 comments on commit b67dacc

Please sign in to comment.