Skip to content

Commit fb93d2a

Browse files
committed
ACP2E-2755: Issue with rest api after enable 2FA Duo
1 parent f812fbb commit fb93d2a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine;
1010

11+
use Magento\User\Api\Data\UserInterface;
1112
use Magento\Framework\App\Config\ScopeConfigInterface;
1213
use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity;
1314
use PHPUnit\Framework\MockObject\MockObject;
@@ -26,13 +27,19 @@ class DuoSecurityTest extends TestCase
2627
*/
2728
private $configMock;
2829

30+
/**
31+
* @var UserInterface|MockObject
32+
*/
33+
private $user;
34+
2935
/**
3036
* @inheritDoc
3137
*/
3238
protected function setUp(): void
3339
{
3440
$objectManager = new ObjectManager($this);
3541
$this->configMock = $this->getMockBuilder(ScopeConfigInterface::class)->disableOriginalConstructor()->getMock();
42+
$this->user = $this->getMockBuilder(UserInterface::class)->disableOriginalConstructor()->getMock();
3643

3744
$this->model = $objectManager->getObject(DuoSecurity::class, ['scopeConfig' => $this->configMock]);
3845
}
@@ -119,4 +126,16 @@ public function testIsEnabled(
119126

120127
$this->assertEquals($expected, $this->model->isEnabled());
121128
}
129+
130+
public function testGetRequestSignature() : void
131+
{
132+
$this->user->expects($this->any())
133+
->method('getUserName')
134+
->willReturn('admin');
135+
$this->configMock->expects($this->any())
136+
->method('getValue')
137+
->willReturn('SECRET');
138+
139+
$this->assertStringContainsString($this->model::AUTH_PREFIX, $this->model->getRequestSignature($this->user));
140+
}
122141
}

0 commit comments

Comments
 (0)