-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
238ff4f
commit 91c325f
Showing
4 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,14 +71,20 @@ public function testUserLoginSuccessEvent() | |
$this->assertEquals('track_user_login_success_event', $events[0]['eventName']); | ||
} | ||
|
||
public function testUserLoginSuccessEvent() | ||
public function testLoggedInCalls() | ||
{ | ||
$id = 1234; | ||
$name = 'someName'; | ||
$email = '[email protected]'; | ||
$this->createUser($id, $name, $email); | ||
|
||
$this->login($email); | ||
//First log in | ||
$traces = $this->login($email); | ||
|
||
$meta = $traces[0][0]['meta']; | ||
$this->assertEquals($id, $meta['usr.id']); | ||
$this->assertEquals($name, $meta['usr.name']); | ||
$this->assertEquals($email, $meta['usr.email']); | ||
|
||
$events = AppsecStatus::getInstance()->getEvents(); | ||
$this->assertEquals(1, count($events)); | ||
|
@@ -87,6 +93,19 @@ public function testUserLoginSuccessEvent() | |
$this->assertEquals($email, $events[0]['metadata']['email']); | ||
$this->assertTrue($events[0]['automated']); | ||
$this->assertEquals('track_user_login_success_event', $events[0]['eventName']); | ||
|
||
//Now we are logged in lets do another call | ||
AppsecStatus::getInstance()->setDefaults(); //Remove all events | ||
$traces = $this->tracesFromWebRequest(function () { | ||
$this->call(GetSpec::create('Behind auth', '/behind_auth')); | ||
}); | ||
|
||
$events = AppsecStatus::getInstance()->getEvents(); | ||
$this->assertEquals(0, count($events)); //Auth does not generate appsec events | ||
$meta = $traces[0][0]['meta']; | ||
$this->assertEquals($id, $meta['usr.id']); | ||
$this->assertEquals($name, $meta['usr.name']); | ||
$this->assertEquals($email, $meta['usr.email']); | ||
} | ||
|
||
public function testUserLoginFailureEvent() | ||
|