From 358d761bf123f32360964a48cb1896364077f91c Mon Sep 17 00:00:00 2001 From: Pozitronik Date: Mon, 11 Dec 2023 17:24:00 +0400 Subject: [PATCH] Tests fixes after global settings refactoring --- tests/CloudMailRuTest.dpr | 96 ++++++++++--------- tests/CloudMailRuTest.dproj | 8 +- tests/models/settings/AccountsManagerTest.pas | 2 +- .../settings/PluginSettingsManagerTest.pas | 5 +- 4 files changed, 57 insertions(+), 54 deletions(-) diff --git a/tests/CloudMailRuTest.dpr b/tests/CloudMailRuTest.dpr index c47598d..6502307 100644 --- a/tests/CloudMailRuTest.dpr +++ b/tests/CloudMailRuTest.dpr @@ -6,53 +6,55 @@ {$STRONGLINKTYPES ON} uses - System.SysUtils, - {$IFDEF TESTINSIGHT} - TestInsight.DUnitX, - {$ELSE} - DUnitX.Loggers.Console, - DUnitX.Loggers.Xml.NUnit, - {$ENDIF } - DUnitX.TestFramework, - TestHelper in 'TestHelper.pas', - TCLoggerTest in 'models\TCLoggerTest.pas', - TCLogger in '..\models\TCLogger.pas', - PLUGIN_TYPES in '..\PLUGIN_TYPES.pas', - SystemHelper in '..\helpers\SystemHelper.pas', - TCProgress in '..\models\TCProgress.pas', - TCProgressTest in 'models\TCProgressTest.pas', - TCRequest in '..\models\TCRequest.pas', - TCRequestTest in 'models\TCRequestTest.pas', - FileHelper in '..\helpers\FileHelper.pas', - PathHelper in '..\helpers\PathHelper.pas', - WindowsHelper in '..\helpers\WindowsHelper.pas', - ConnectionSettings in '..\models\settings\ConnectionSettings.pas', - SETTINGS_CONSTANTS in '..\models\settings\SETTINGS_CONSTANTS.pas', - CMRConstants in '..\CMRConstants.pas', - ProxySettings in '..\models\settings\ProxySettings.pas', - StringHelper in '..\helpers\StringHelper.pas', - TCHelper in '..\helpers\TCHelper.pas', - Description in '..\models\Description.pas', - CMRStrings in '..\CMRStrings.pas', - PluginSettingsManagerTest in 'models\settings\PluginSettingsManagerTest.pas', - AccountsManagerTest in 'models\settings\AccountsManagerTest.pas', - ParsingHelper in '..\helpers\ParsingHelper.pas', - WSList in '..\models\WSList.pas', - AccountSettings in '..\models\settings\AccountSettings.pas', - AccountsManager in '..\models\settings\AccountsManager.pas', - FileCipher in '..\models\cipher\FileCipher.pas', - CMRDirItemList in '..\models\dto\CMRDirItemList.pas', - CMRDirItem in '..\models\dto\CMRDirItem.pas', - JSONHelper in '..\helpers\JSONHelper.pas', - DCPblockciphers in '..\DCPCrypt\DCPblockciphers.pas', - DCPcrypt2 in '..\DCPCrypt\DCPcrypt2.pas', - DCPtypes in '..\DCPCrypt\DCPtypes.pas', - DCPrijndael in '..\DCPCrypt\Ciphers\DCPrijndael.pas', - DCPconst in '..\DCPCrypt\DCPconst.pas', - DCPbase64 in '..\DCPCrypt\DCPbase64.pas', - DCPsha1 in '..\DCPCrypt\Hashes\DCPsha1.pas', - PluginSettingsManager in '..\models\settings\PluginSettingsManager.pas', - PluginSettings in '..\models\settings\PluginSettings.pas'; + System.SysUtils, +{$IFDEF TESTINSIGHT} + TestInsight.DUnitX, +{$ELSE} + DUnitX.Loggers.Console, + DUnitX.Loggers.Xml.NUnit, +{$ENDIF } + DUnitX.TestFramework, + TestHelper in 'TestHelper.pas', + TCLoggerTest in 'models\TCLoggerTest.pas', + TCLogger in '..\models\TCLogger.pas', + PLUGIN_TYPES in '..\types\PLUGIN_TYPES.pas', + SystemHelper in '..\helpers\SystemHelper.pas', + TCProgress in '..\models\TCProgress.pas', + TCProgressTest in 'models\TCProgressTest.pas', + TCRequest in '..\models\TCRequest.pas', + TCRequestTest in 'models\TCRequestTest.pas', + FileHelper in '..\helpers\FileHelper.pas', + PathHelper in '..\helpers\PathHelper.pas', + WindowsHelper in '..\helpers\WindowsHelper.pas', + ConnectionSettings in '..\models\settings\ConnectionSettings.pas', + SETTINGS_CONSTANTS in '..\models\settings\SETTINGS_CONSTANTS.pas', + CMRConstants in '..\types\CMRConstants.pas', + ProxySettings in '..\models\settings\ProxySettings.pas', + StringHelper in '..\helpers\StringHelper.pas', + TCHelper in '..\helpers\TCHelper.pas', + Description in '..\models\Description.pas', + LANGUAGE_STRINGS in '..\types\LANGUAGE_STRINGS.pas', + PluginSettingsManagerTest in 'models\settings\PluginSettingsManagerTest.pas', + AccountsManagerTest in 'models\settings\AccountsManagerTest.pas', + ParsingHelper in '..\helpers\ParsingHelper.pas', + WSList in '..\models\WSList.pas', + AccountSettings in '..\models\settings\AccountSettings.pas', + AccountsManager in '..\models\settings\AccountsManager.pas', + FileCipher in '..\models\cipher\FileCipher.pas', + CMRDirItemList in '..\models\dto\CMRDirItemList.pas', + CMRDirItem in '..\models\dto\CMRDirItem.pas', + JSONHelper in '..\helpers\JSONHelper.pas', + DCPblockciphers in '..\DCPCrypt\DCPblockciphers.pas', + DCPcrypt2 in '..\DCPCrypt\DCPcrypt2.pas', + DCPtypes in '..\DCPCrypt\DCPtypes.pas', + DCPrijndael in '..\DCPCrypt\Ciphers\DCPrijndael.pas', + DCPconst in '..\DCPCrypt\DCPconst.pas', + DCPbase64 in '..\DCPCrypt\DCPbase64.pas', + DCPsha1 in '..\DCPCrypt\Hashes\DCPsha1.pas', + PluginSettingsManager in '..\models\settings\PluginSettingsManager.pas', + PluginSettings in '..\models\settings\PluginSettings.pas', + IniFilesHelper in '..\helpers\IniFilesHelper.pas', + StreamingSettings in '..\models\settings\StreamingSettings.pas'; {keep comment here to protect the following conditional from being removed by the IDE when adding a unit} {$IFNDEF TESTINSIGHT} diff --git a/tests/CloudMailRuTest.dproj b/tests/CloudMailRuTest.dproj index 71c0b58..57c9784 100644 --- a/tests/CloudMailRuTest.dproj +++ b/tests/CloudMailRuTest.dproj @@ -110,7 +110,7 @@ - + @@ -121,12 +121,12 @@ - + - + @@ -146,6 +146,8 @@ + + Base diff --git a/tests/models/settings/AccountsManagerTest.pas b/tests/models/settings/AccountsManagerTest.pas index 2fdacef..1530bb3 100644 --- a/tests/models/settings/AccountsManagerTest.pas +++ b/tests/models/settings/AccountsManagerTest.pas @@ -65,7 +65,7 @@ procedure TAccountsManagerTest.TestClearPassword; TestAccountsManager := TAccountsManager.Create(self.AppDir + FP_ACCOUNTS_INI); Assert.IsNotEmpty(TestAccountsManager.GetAccountSettings('NEW_ACCOUNT').Password); - TestAccountsManager.ClearPassword('NEW_ACCOUNT'); + TestAccountsManager.SwitchPasswordStorage('NEW_ACCOUNT'); Assert.IsEmpty(TestAccountsManager.GetAccountSettings('NEW_ACCOUNT').Password); TestAccountsManager.Free; end; diff --git a/tests/models/settings/PluginSettingsManagerTest.pas b/tests/models/settings/PluginSettingsManagerTest.pas index 65535d5..4ecb934 100644 --- a/tests/models/settings/PluginSettingsManagerTest.pas +++ b/tests/models/settings/PluginSettingsManagerTest.pas @@ -73,7 +73,7 @@ procedure TPluginSettingsManagerTest.TestCreateFindFile; {It finds no config, but writeable application directory, and uses it} Assert.AreEqual(self.AppDir, TempSettingsManager.ApplicationPath); - Assert.AreEqual(INI_DIR_PLUGIN, TempSettingsManager.Settings.IniDir); + Assert.isTrue(TempSettingsManager.Settings.IniDir = INI_DIR_PLUGIN); TempSettingsManager.Free; @@ -99,7 +99,7 @@ procedure TPluginSettingsManagerTest.TestCreateFromKnownFile; TempSettingsManager := TPluginSettingsManager.Create(DataPath(FP_SETTINGS_INI)); {peek some randoms of different data types} - Assert.IsTrue(TempSettingsManager.Settings.DescriptionEnabled); //boolean + Assert.isTrue(TempSettingsManager.Settings.DescriptionEnabled); //boolean Assert.AreEqual(1000, TempSettingsManager.Settings.AttemptWait); //integer Assert.AreEqual('descript.ed', TempSettingsManager.Settings.DescriptionFileName); //string Assert.IsFalse(TempSettingsManager.Settings.ConnectionSettings.ProxySettings.UseTCPasswordManager); //subrecord boolean @@ -109,7 +109,6 @@ procedure TPluginSettingsManagerTest.TestCreateFromKnownFile; end; - initialization TDUnitX.RegisterTestFixture(TPluginSettingsManagerTest);