Skip to content

Commit

Permalink
Merge branch 'feature/PB-27758_TotpResourceTypes-plugin-should-be-ena…
Browse files Browse the repository at this point in the history
…bled-by-default' into 'release'

PB-27758 Enable TotpResourceTypes per default

See merge request passbolt/passbolt-ce-api!184
  • Loading branch information
pabloelcolombiano committed Sep 21, 2023
2 parents c89fa77 + 7136726 commit 071309b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 39 deletions.
2 changes: 1 addition & 1 deletion config/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
'enabled' => filter_var(env('PASSBOLT_PLUGINS_RESOURCE_TYPES_ENABLED', true), FILTER_VALIDATE_BOOLEAN)
],
'totpResourceTypes' => [
'enabled' => filter_var(env('PASSBOLT_PLUGINS_TOTP_RESOURCE_TYPES_ENABLED', false), FILTER_VALIDATE_BOOLEAN),
'enabled' => filter_var(env('PASSBOLT_PLUGINS_TOTP_RESOURCE_TYPES_ENABLED', true), FILTER_VALIDATE_BOOLEAN),
],
'mobile' => [
'enabled' => filter_var(env('PASSBOLT_PLUGINS_MOBILE_ENABLED', true), FILTER_VALIDATE_BOOLEAN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,6 @@ class ResourceTypesIndexControllerTest extends AppIntegrationTestCase
{
use ResourceTypesModelTrait;

/**
* @inheritDoc
*/
public function setUp(): void
{
parent::setUp();

$this->enableFeaturePlugin(TotpResourceTypesPlugin::class);
}

/**
* @inheritDoc
*/
public function tearDown(): void
{
parent::tearDown();

$this->disableFeaturePlugin(TotpResourceTypesPlugin::class);
}

public function testResourceTypesIndex_Success_WithTotpResourceTypes()
{
$this->loadFixtureScenario(ResourceTypesScenario::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
namespace Passbolt\TotpResourceTypes\Test\TestCase\Controller\Settings;

use App\Test\Lib\AppIntegrationTestCase;
use Passbolt\TotpResourceTypes\TotpResourceTypesPlugin;

class SettingsIndexControllerTest extends AppIntegrationTestCase
{
Expand All @@ -27,8 +26,8 @@ public function testSettingsIndexController_SuccessAsLU()
$this->logInAsUser();
$this->getJson('/settings.json?api-version=2');
$this->assertSuccess();
// Assert TOTP resource type disabled by default
$this->assertFalse($this->_responseJsonBody->passbolt->plugins->totpResourceTypes->enabled);
// Assert TOTP resource type enabled by default
$this->assertTrue($this->_responseJsonBody->passbolt->plugins->totpResourceTypes->enabled);
}

public function testSettingsIndexController_SuccessAsAN()
Expand All @@ -38,16 +37,4 @@ public function testSettingsIndexController_SuccessAsAN()
// Assert TOTP resource type plugin is not visible for anonymous users
$this->assertObjectNotHasAttribute('totpResourceTypes', $this->_responseJsonBody->passbolt->plugins);
}

public function testSettingsIndexController_Success_TotpResourceTypeEnabled()
{
$this->logInAsUser();
// Enable TotpResourceType plugin
$this->enableFeaturePlugin(TotpResourceTypesPlugin::class);

$this->getJson('/settings.json?api-version=2');

$this->assertSuccess();
$this->assertTrue($this->_responseJsonBody->passbolt->plugins->totpResourceTypes->enabled);
}
}
3 changes: 0 additions & 3 deletions tests/Lib/SolutionBootstrapperTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Cake\Utility\Hash;
use Passbolt\EmailDigest\Utility\Digest\DigestsPool;
use Passbolt\EmailNotificationSettings\Utility\EmailNotificationSettings;
use Passbolt\TotpResourceTypes\TotpResourceTypesPlugin;

abstract class SolutionBootstrapperTestCase extends TestCase
{
Expand All @@ -42,14 +41,12 @@ public function setUp(): void
$this->clearPlugins();
DigestsPool::clearInstance();
EmailNotificationSettings::flushCache();
$this->enableFeaturePlugin(TotpResourceTypesPlugin::class);
}

public function tearDown(): void
{
$this->clearPlugins();
unset($this->app);
$this->disableFeaturePlugin(TotpResourceTypesPlugin::class);

parent::tearDown();
}
Expand Down

0 comments on commit 071309b

Please sign in to comment.