-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stepan Blyshchak <[email protected]>
- Loading branch information
1 parent
1d2b20a
commit 6f47365
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import imp | ||
import sys | ||
import os | ||
import pytest | ||
|
||
import swsssdk | ||
|
||
from .mock_connector import MockConnector | ||
|
||
swsssdk.SonicV2Connector = MockConnector | ||
|
||
test_path = os.path.dirname(os.path.abspath(__file__)) | ||
modules_path = os.path.dirname(test_path) | ||
scripts_path = os.path.join(modules_path, "scripts") | ||
sys.path.insert(0, modules_path) | ||
|
||
imp.load_source('hostcfgd', scripts_path + '/hostcfgd') | ||
from hostcfgd import * | ||
|
||
class TestHostConfigurationDaemon(object): | ||
def test_feature_config_parsing(self): | ||
swss_feature = Feature('swss', { | ||
'state': 'enabled', | ||
'auto_restart': 'enabled', | ||
'has_timer': 'True', | ||
'has_global_scope': 'False', | ||
'has_per_asic_scope': 'True', | ||
}) | ||
|
||
assert swss_feature.name == 'swss' | ||
assert swss_feature.state == 'enabled' | ||
assert swss_feature.auto_restart == 'enabled' | ||
assert swss_feature.has_timer | ||
assert not swss_feature.has_global_scope | ||
assert swss_feature.has_per_asic_scope | ||
|
||
def test_feature_config_parsing_defaults(self): | ||
swss_feature = Feature('swss', { | ||
'state': 'enabled', | ||
}) | ||
|
||
assert swss_feature.name == 'swss' | ||
assert swss_feature.state == 'enabled' | ||
assert swss_feature.auto_restart == 'disabled' | ||
assert not swss_feature.has_timer | ||
assert swss_feature.has_global_scope | ||
assert not swss_feature.has_per_asic_scope |