Tests: Fix tests

This commit is contained in:
Nodir Temirkhodjaev 2023-07-17 14:20:35 +03:00
parent 9699d520eb
commit 4d760b9776
3 changed files with 9 additions and 4 deletions

View File

@ -18,6 +18,7 @@
#include <stat/statmanager.h>
#include <util/dateutil.h>
#include <util/fileutil.h>
#include <util/ioc/ioccontainer.h>
#include <mocks/mockquotamanager.h>
@ -99,9 +100,13 @@ void debugStatTraf(SqliteDb *sqliteDb)
TEST_F(StatTest, dbWriteRead)
{
NiceMock<MockQuotaManager> quotaManager;
IocContainer ioc;
ioc.pinToThread();
StatManager statManager(":memory:", &quotaManager);
NiceMock<MockQuotaManager> quotaManager;
ioc.set<QuotaManager>(quotaManager);
StatManager statManager(":memory:");
statManager.setUp();

View File

@ -92,7 +92,7 @@ TEST_F(ConfUtilTest, confWriteRead)
ASSERT_TRUE(DriverCommon::confAppBlocked(
data, DriverCommon::confAppFind(data, "System"), &blockReason));
ASSERT_EQ(blockReason, FORT_BLOCK_REASON_FILTER_MODE);
ASSERT_EQ(blockReason, FORT_BLOCK_REASON_APP_GROUP_FOUND);
ASSERT_FALSE(DriverCommon::confAppBlocked(data,
DriverCommon::confAppFind(

View File

@ -128,7 +128,7 @@ void StatManager::updateActivePeriod()
m_isActivePeriodSet = true;
m_isActivePeriod = true;
if (conf()->activePeriodEnabled()) {
if (conf() && conf()->activePeriodEnabled()) {
const QTime now = QTime::currentTime();
m_isActivePeriod = DriverCommon::isTimeInPeriod(quint8(now.hour()),