Skip to content

Commit 3d8679f

Browse files
committed
CABPI-390: Do not allow to enable AdminAdobeIms when 2FA is disabled on IMS
1 parent 8155ad1 commit 3d8679f

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

app/code/Magento/AdminAdobeIms/Test/Unit/Command/AdminAdobeImsEnableCommandTest.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ protected function setUp(): void
102102
* @param InvokedCountMatcher$enableMethodCallExpection
103103
* @param InvokedCountMatcher $cleanMethodCallExpection
104104
* @param string $outputMessage
105+
* @param bool $isTwoFactorAuthEnabled
105106
* @return void
106107
* @throws Exception
107108
* @dataProvider cliCommandProvider
@@ -110,7 +111,8 @@ public function testAdminAdobeImsModuleEnableWillClearCacheWhenSuccessful(
110111
bool $testAuthMode,
111112
InvokedCountMatcher $enableMethodCallExpection,
112113
InvokedCountMatcher $cleanMethodCallExpection,
113-
string $outputMessage
114+
string $outputMessage,
115+
bool $isTwoFactorAuthEnabled
114116
): void {
115117
$inputMock = $this->getMockBuilder(InputInterface::class)
116118
->getMockForAbstractClass();
@@ -123,6 +125,7 @@ public function testAdminAdobeImsModuleEnableWillClearCacheWhenSuccessful(
123125
$this->imsCommandOptionService->method('getOrganizationId')->willReturn('orgId');
124126
$this->imsCommandOptionService->method('getClientId')->willReturn('clientId');
125127
$this->imsCommandOptionService->method('getClientSecret')->willReturn('clientSecret');
128+
$this->imsCommandOptionService->method('isTwoFactorAuthEnabled')->willReturn($isTwoFactorAuthEnabled);
126129

127130
$this->imsConnectionMock->method('testAuth')
128131
->willReturn($testAuthMode);
@@ -161,15 +164,33 @@ public function cliCommandProvider(): array
161164
true,
162165
$this->once(),
163166
$this->once(),
164-
'Admin Adobe IMS integration is enabled'
167+
'Admin Adobe IMS integration is enabled',
168+
true
165169
],
166170
[
167171
false,
168172
$this->never(),
169173
$this->never(),
170-
'<error>The Client ID, Client Secret and Organization ID are required ' .
171-
'when enabling the Admin Adobe IMS Module</error>'
174+
'<error>The Client ID, Client Secret, Organization ID and 2FA Auth are required ' .
175+
'when enabling the Admin Adobe IMS Module</error>',
176+
true
172177
],
178+
[
179+
true,
180+
$this->never(),
181+
$this->never(),
182+
'<error>The Client ID, Client Secret, Organization ID and 2FA Auth are required ' .
183+
'when enabling the Admin Adobe IMS Module</error>',
184+
false
185+
],
186+
[
187+
false,
188+
$this->never(),
189+
$this->never(),
190+
'<error>The Client ID, Client Secret, Organization ID and 2FA Auth are required ' .
191+
'when enabling the Admin Adobe IMS Module</error>',
192+
false
193+
]
173194
];
174195
}
175196

0 commit comments

Comments
 (0)