Leosac  0.8.0
Open Source Access Control
Leosac::Test Namespace Reference

Unit test live in this namespace. More...

Namespaces

 Helper
 Unit testing utility class that helps writing test.
 

Classes

class  AuthFileMapperTest
 Test the mapping of wiegand-card to user from a file. More...
 
class  AuthSourceBuilderTest
 Test the AuthSourceBuilder ability to create AuthSource object from messages. More...
 
class  ConfigManagerTest
 
struct  DummyChildVisitable
 
struct  DummyConstOnlyVisitor
 
struct  DummyServiceImpl
 
struct  DummyServiceInterface
 
struct  DummyServiceInterface2
 
struct  DummyVisitable
 
struct  DummyVisitor
 
struct  DummyVisitor2
 Visitor2 that is ready to visit object of type DummyVisitable, but not of type DummyChildVisitable. More...
 
class  LedTest
 
class  RemoteControlSecurityTest
 
class  RplethTest
 
class  SysFsGpioConfigTest
 Note this class doesnt inherits the TestHelper class. More...
 
class  WiegandReaderTest
 

Functions

 TEST_F (AuthFileMapperTest, SimpleMapping)
 Successful mapping. More...
 
 TEST_F (AuthFileMapperTest, TimeFrameMapping)
 Test that time frame for access a properly loaded and that the AccessProfile is coherent with the configuration file. More...
 
 TEST_F (AuthFileMapperTest, TimeFrameMapping2)
 Test time frame with default_schedule param. More...
 
 TEST_F (AuthFileMapperTest, NotFoundMapping)
 Card ID doesn't exist in the file. More...
 
 TEST_F (AuthFileMapperTest, InvalidFile)
 File is not accessible. More...
 
 TEST_F (AuthFileMapperTest, InvalidFileContent)
 AuthFile-2.xml has invalid content. More...
 
 TEST_F (AuthFileMapperTest, TestGroupMapping)
 
 TEST_F (AuthFileMapperTest, TestMultiGroupMapping)
 
 TEST_F (AuthFileMapperTest, TestGroupPermission)
 Test that group permission applies to user. More...
 
 TEST_F (AuthFileMapperTest, TestMultiGroupPermission)
 Tests that permissions from multiple groups are added together. More...
 
 TEST_F (AuthFileMapperTest, TestGroupAndUserPermission)
 Tests that single-user permission and group permission works well together. More...
 
 TEST_F (AuthFileMapperTest, UnkownCardId)
 
 TEST_F (AuthFileMapperTest, TestWiegandCardAndPin)
 
 TEST_F (AuthFileMapperTest, TestUserValidityLimit)
 
 TEST_F (AuthFileMapperTest, TestCredentialsValidityLimit)
 
 TEST_F (AuthFileMapperTest, TestCredentialSchedule)
 
 TEST_F (AuthFileMapperTest, TestReservedUserID)
 UserID UNKNOWN_USER is reserved to prevent confusion in the log file. More...
 
 TEST_F (AuthSourceBuilderTest, ExtractSourceName)
 
 TEST_F (AuthSourceBuilderTest, BuildWiegandCard)
 
 TEST_F (AuthSourceBuilderTest, BuildPin)
 
 TEST_F (AuthSourceBuilderTest, BuildCardAndPing)
 
 TEST_F (ConfigManagerTest, store_load)
 
 TEST_F (ConfigManagerTest, access_cfg)
 
 TEST_F (ConfigManagerTest, build_cfg)
 
 TEST_F (ConfigManagerTest, build_safe_cfg)
 Like build_cfg test, but we build a config tree for export. More...
 
 TEST_F (ConfigManagerTest, build_safe_cfg2)
 Same as build_safe_cfg but with a second config file. More...
 
 TEST_F (ConfigManagerTest, build_safe_cfg3)
 
 TEST_F (ConfigManagerTest, test_sync_dest)
 Config4 export remote and log. More...
 
 TEST_F (ConfigManagerTest, test_sync_dest2)
 Config6 export remote and log. More...
 
 TEST_F (ConfigManagerTest, tes_no_import)
 Config 8 test. More...
 
 TEST (TestCredentialValidator, alias_length)
 
 TEST (TestWiegandCardValidator, card_id)
 
 TEST (TestWiegandCardValidator, nb_bits)
 
 TEST (TestWiegandPinValidator, pin_is_numeric)
 
 TEST (TestGroup, memberships)
 
 TEST (TestGroupValidator, name_length)
 
 TEST (TestGroupValidator, name_invalid_char)
 
 TEST_F (LedTest, turnOn)
 
 TEST_F (LedTest, turnOff)
 
 TEST_F (LedTest, toggle)
 
 TEST_F (LedTest, blink1)
 Test blinking, starting with a led that is OFF. More...
 
 TEST_F (LedTest, blink2)
 Test blinking, starting with a led that is ON. More...
 
 TEST_F (LedTest, blink3)
 Test regression for #61. More...
 
 TEST (TestRegistry, valid_get_set)
 
 TEST (TestRegistry, invalid_get_set)
 
 TEST (TestRegistry, expiration)
 
 TEST (TestRegistry, auto_expiration)
 
 TEST_F (RemoteControlSecurityTest, Test1)
 
 TEST_F (RemoteControlSecurityTest, TestNoSecurityInformation)
 Test default setting, when no <security> tag is present. More...
 
 TEST (TestRFIDCard, convert_to_int)
 
 TEST (TestRFIDCard, wiegand_26)
 
 TEST (TestRFIDCard, bits_56)
 Test when the reader returns 56 bits (7 bytes). More...
 
 TEST (Rpleth, TestConvertCard)
 
 TEST_F (RplethTest, TestReceiveStreamCardsSimple)
 Check that a rpleth receive cards that are read. More...
 
 TEST_F (RplethTest, TestReceiveStreamCards2)
 
 TEST (TestScheduleValidator, name_length)
 
 TEST (TestRegistry, register_get_service)
 
 TEST (TestRegistry, unregister_simple)
 
 TEST (TestRegistry, unregister_while_used)
 
 TEST (TestRegistry, unregister_no_param)
 
 TEST_F (SysFsGpioConfigTest, ExportUnexportPath)
 
 TEST_F (SysFsGpioConfigTest, PathAndDefaultAliases)
 
 TEST_F (SysFsGpioConfigTest, MoreComplexeAliases)
 
 TEST (VersionTest, buildVersionString)
 
 TEST (VersionTest, versionCompare)
 
 TEST (VersionTest, isVersionValid)
 
 TEST (TestVisitor, simple_non_const)
 
 TEST (TestVisitor, simple_const)
 
 TEST (TestVisitor, const_visit_accept_non_const_visitable)
 
 TEST (TestVisitor, const_visit_accept_const_visitable)
 
 TEST (TestVisitor, test_class_hierarchy)
 
 TEST_F (WiegandReaderTest, readCard)
 

Detailed Description

Unit test live in this namespace.

Function Documentation

◆ TEST() [1/28]

Leosac::Test::TEST ( Rpleth  ,
TestConvertCard   
)

Definition at line 118 of file Rpleth.cpp.

◆ TEST() [2/28]

Leosac::Test::TEST ( TestCredentialValidator  ,
alias_length   
)

Definition at line 34 of file CredentialValidator.cpp.

◆ TEST() [3/28]

Leosac::Test::TEST ( TestGroup  ,
memberships   
)

Definition at line 33 of file GroupValidator.cpp.

◆ TEST() [4/28]

Leosac::Test::TEST ( TestGroupValidator  ,
name_invalid_char   
)

Definition at line 68 of file GroupValidator.cpp.

◆ TEST() [5/28]

Leosac::Test::TEST ( TestGroupValidator  ,
name_length   
)

Definition at line 52 of file GroupValidator.cpp.

◆ TEST() [6/28]

Leosac::Test::TEST ( TestRegistry  ,
auto_expiration   
)

Definition at line 75 of file Registry.cpp.

◆ TEST() [7/28]

Leosac::Test::TEST ( TestRegistry  ,
expiration   
)

Definition at line 52 of file Registry.cpp.

◆ TEST() [8/28]

Leosac::Test::TEST ( TestRegistry  ,
invalid_get_set   
)

Definition at line 42 of file Registry.cpp.

◆ TEST() [9/28]

Leosac::Test::TEST ( TestRegistry  ,
register_get_service   
)

Definition at line 47 of file ServiceRegistry.cpp.

◆ TEST() [10/28]

Leosac::Test::TEST ( TestRegistry  ,
unregister_no_param   
)

Definition at line 118 of file ServiceRegistry.cpp.

◆ TEST() [11/28]

Leosac::Test::TEST ( TestRegistry  ,
unregister_simple   
)

Definition at line 80 of file ServiceRegistry.cpp.

◆ TEST() [12/28]

Leosac::Test::TEST ( TestRegistry  ,
unregister_while_used   
)

Definition at line 103 of file ServiceRegistry.cpp.

◆ TEST() [13/28]

Leosac::Test::TEST ( TestRegistry  ,
valid_get_set   
)

Definition at line 30 of file Registry.cpp.

◆ TEST() [14/28]

Leosac::Test::TEST ( TestRFIDCard  ,
bits_56   
)

Test when the reader returns 56 bits (7 bytes).

We do nothing special here. Just convert to uint64_t.

Definition at line 76 of file RFIDCard.cpp.

◆ TEST() [15/28]

Leosac::Test::TEST ( TestRFIDCard  ,
convert_to_int   
)

Definition at line 30 of file RFIDCard.cpp.

◆ TEST() [16/28]

Leosac::Test::TEST ( TestRFIDCard  ,
wiegand_26   
)

Definition at line 48 of file RFIDCard.cpp.

◆ TEST() [17/28]

Leosac::Test::TEST ( TestScheduleValidator  ,
name_length   
)

Definition at line 32 of file ScheduleValidator.cpp.

◆ TEST() [18/28]

Leosac::Test::TEST ( TestVisitor  ,
const_visit_accept_const_visitable   
)

Definition at line 99 of file Visitor.cpp.

◆ TEST() [19/28]

Leosac::Test::TEST ( TestVisitor  ,
const_visit_accept_non_const_visitable   
)

Definition at line 91 of file Visitor.cpp.

◆ TEST() [20/28]

Leosac::Test::TEST ( TestVisitor  ,
simple_const   
)

Definition at line 67 of file Visitor.cpp.

◆ TEST() [21/28]

Leosac::Test::TEST ( TestVisitor  ,
simple_non_const   
)

Definition at line 58 of file Visitor.cpp.

◆ TEST() [22/28]

Leosac::Test::TEST ( TestVisitor  ,
test_class_hierarchy   
)

Definition at line 132 of file Visitor.cpp.

◆ TEST() [23/28]

Leosac::Test::TEST ( TestWiegandCardValidator  ,
card_id   
)

Definition at line 55 of file CredentialValidator.cpp.

◆ TEST() [24/28]

Leosac::Test::TEST ( TestWiegandCardValidator  ,
nb_bits   
)

Definition at line 68 of file CredentialValidator.cpp.

◆ TEST() [25/28]

Leosac::Test::TEST ( TestWiegandPinValidator  ,
pin_is_numeric   
)

Definition at line 80 of file CredentialValidator.cpp.

◆ TEST() [26/28]

Leosac::Test::TEST ( VersionTest  ,
buildVersionString   
)

Definition at line 30 of file version.cpp.

◆ TEST() [27/28]

Leosac::Test::TEST ( VersionTest  ,
isVersionValid   
)

Definition at line 44 of file version.cpp.

◆ TEST() [28/28]

Leosac::Test::TEST ( VersionTest  ,
versionCompare   
)

Definition at line 36 of file version.cpp.

◆ TEST_F() [1/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
InvalidFile   
)

File is not accessible.

Definition at line 295 of file AuthFile.cpp.

◆ TEST_F() [2/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
InvalidFileContent   
)

AuthFile-2.xml has invalid content.

Definition at line 305 of file AuthFile.cpp.

◆ TEST_F() [3/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
NotFoundMapping   
)

Card ID doesn't exist in the file.

Definition at line 285 of file AuthFile.cpp.

◆ TEST_F() [4/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
SimpleMapping   
)

Successful mapping.

Definition at line 197 of file AuthFile.cpp.

◆ TEST_F() [5/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestCredentialSchedule   
)

Definition at line 480 of file AuthFile.cpp.

◆ TEST_F() [6/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestCredentialsValidityLimit   
)

Definition at line 464 of file AuthFile.cpp.

◆ TEST_F() [7/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestGroupAndUserPermission   
)

Tests that single-user permission and group permission works well together.

Definition at line 409 of file AuthFile.cpp.

◆ TEST_F() [8/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestGroupMapping   
)

Definition at line 316 of file AuthFile.cpp.

◆ TEST_F() [9/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestGroupPermission   
)

Test that group permission applies to user.

Definition at line 342 of file AuthFile.cpp.

◆ TEST_F() [10/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestMultiGroupMapping   
)

Definition at line 325 of file AuthFile.cpp.

◆ TEST_F() [11/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestMultiGroupPermission   
)

Tests that permissions from multiple groups are added together.

If a user is in 2 groups it should have both group permissions.

Definition at line 367 of file AuthFile.cpp.

◆ TEST_F() [12/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestReservedUserID   
)

UserID UNKNOWN_USER is reserved to prevent confusion in the log file.

Test that the mapper refuse to build when such a user is defined.

Definition at line 522 of file AuthFile.cpp.

◆ TEST_F() [13/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestUserValidityLimit   
)

Definition at line 448 of file AuthFile.cpp.

◆ TEST_F() [14/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TestWiegandCardAndPin   
)

Definition at line 436 of file AuthFile.cpp.

◆ TEST_F() [15/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TimeFrameMapping   
)

Test that time frame for access a properly loaded and that the AccessProfile is coherent with the configuration file.

Definition at line 220 of file AuthFile.cpp.

◆ TEST_F() [16/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
TimeFrameMapping2   
)

Test time frame with default_schedule param.

Definition at line 261 of file AuthFile.cpp.

◆ TEST_F() [17/44]

Leosac::Test::TEST_F ( AuthFileMapperTest  ,
UnkownCardId   
)

Definition at line 429 of file AuthFile.cpp.

◆ TEST_F() [18/44]

Leosac::Test::TEST_F ( AuthSourceBuilderTest  ,
BuildCardAndPing   
)

Definition at line 121 of file AuthSourceBuilder.cpp.

◆ TEST_F() [19/44]

Leosac::Test::TEST_F ( AuthSourceBuilderTest  ,
BuildPin   
)

Definition at line 110 of file AuthSourceBuilder.cpp.

◆ TEST_F() [20/44]

Leosac::Test::TEST_F ( AuthSourceBuilderTest  ,
BuildWiegandCard   
)

Definition at line 98 of file AuthSourceBuilder.cpp.

◆ TEST_F() [21/44]

Leosac::Test::TEST_F ( AuthSourceBuilderTest  ,
ExtractSourceName   
)

Definition at line 82 of file AuthSourceBuilder.cpp.

◆ TEST_F() [22/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
access_cfg   
)

Definition at line 103 of file ConfigManager.cpp.

◆ TEST_F() [23/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
build_cfg   
)

Definition at line 111 of file ConfigManager.cpp.

◆ TEST_F() [24/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
build_safe_cfg   
)

Like build_cfg test, but we build a config tree for export.

We must make sure that information from <sync_source> are honored.

Definition at line 124 of file ConfigManager.cpp.

◆ TEST_F() [25/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
build_safe_cfg2   
)

Same as build_safe_cfg but with a second config file.

We do not declare <sync_source> there, so we should retrieve everything.

Definition at line 142 of file ConfigManager.cpp.

◆ TEST_F() [26/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
build_safe_cfg3   
)

Definition at line 155 of file ConfigManager.cpp.

◆ TEST_F() [27/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
store_load   
)

Definition at line 91 of file ConfigManager.cpp.

◆ TEST_F() [28/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
tes_no_import   
)

Config 8 test.

Test the no_import feature.

Definition at line 227 of file ConfigManager.cpp.

◆ TEST_F() [29/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
test_sync_dest   
)

Config4 export remote and log.

Config5 import log.

We must only have log once merged.

Definition at line 174 of file ConfigManager.cpp.

◆ TEST_F() [30/44]

Leosac::Test::TEST_F ( ConfigManagerTest  ,
test_sync_dest2   
)

Config6 export remote and log.

Config7 import log.

Make sure config7's remote is not overwritten.

Definition at line 199 of file ConfigManager.cpp.

◆ TEST_F() [31/44]

Leosac::Test::TEST_F ( LedTest  ,
blink1   
)

Test blinking, starting with a led that is OFF.

Definition at line 119 of file Led.cpp.

◆ TEST_F() [32/44]

Leosac::Test::TEST_F ( LedTest  ,
blink2   
)

Test blinking, starting with a led that is ON.

We blink 9 times, so the led will end up OFF.

Definition at line 143 of file Led.cpp.

◆ TEST_F() [33/44]

Leosac::Test::TEST_F ( LedTest  ,
blink3   
)

Test regression for #61.

Definition at line 169 of file Led.cpp.

◆ TEST_F() [34/44]

Leosac::Test::TEST_F ( LedTest  ,
toggle   
)

Definition at line 101 of file Led.cpp.

◆ TEST_F() [35/44]

Leosac::Test::TEST_F ( LedTest  ,
turnOff   
)

Definition at line 87 of file Led.cpp.

◆ TEST_F() [36/44]

Leosac::Test::TEST_F ( LedTest  ,
turnOn   
)

Definition at line 76 of file Led.cpp.

◆ TEST_F() [37/44]

Leosac::Test::TEST_F ( RemoteControlSecurityTest  ,
Test1   
)

Definition at line 58 of file RemoteControlSecurity.cpp.

◆ TEST_F() [38/44]

Leosac::Test::TEST_F ( RemoteControlSecurityTest  ,
TestNoSecurityInformation   
)

Test default setting, when no <security> tag is present.

This should allow everyone to do everything.

Definition at line 79 of file RemoteControlSecurity.cpp.

◆ TEST_F() [39/44]

Leosac::Test::TEST_F ( RplethTest  ,
TestReceiveStreamCards2   
)

Definition at line 154 of file Rpleth.cpp.

◆ TEST_F() [40/44]

Leosac::Test::TEST_F ( RplethTest  ,
TestReceiveStreamCardsSimple   
)

Check that a rpleth receive cards that are read.

Definition at line 143 of file Rpleth.cpp.

◆ TEST_F() [41/44]

Leosac::Test::TEST_F ( SysFsGpioConfigTest  ,
ExportUnexportPath   
)

Definition at line 110 of file SysFsGpioConfig.cpp.

◆ TEST_F() [42/44]

Leosac::Test::TEST_F ( SysFsGpioConfigTest  ,
MoreComplexeAliases   
)

Definition at line 127 of file SysFsGpioConfig.cpp.

◆ TEST_F() [43/44]

Leosac::Test::TEST_F ( SysFsGpioConfigTest  ,
PathAndDefaultAliases   
)

Definition at line 118 of file SysFsGpioConfig.cpp.

◆ TEST_F() [44/44]

Leosac::Test::TEST_F ( WiegandReaderTest  ,
readCard   
)

Definition at line 71 of file WiegandReader.cpp.