-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
37 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 |
---|---|---|
|
@@ -34,13 +34,11 @@ | |
from csle_common.dao.simulation_config.simulation_trace import SimulationTrace | ||
from csle_common.dao.training.agent_type import AgentType | ||
from csle_common.dao.training.player_type import PlayerType | ||
from csle_common.dao.management.management_user import ManagementUser | ||
from csle_common.dao.management.session_token import SessionToken | ||
|
||
|
||
class TestJobsDaoSuite: | ||
""" | ||
Test suite for jobs data access objects (DAOs) | ||
Test suite for job data access objects (DAOs) | ||
""" | ||
|
||
def test_data_collection_job_config(self) -> None: | ||
|
@@ -178,37 +176,3 @@ def test_training_job_config(self) -> None: | |
training_job_config.to_dict()) | ||
assert (TrainingJobConfig.from_dict(training_job_config.to_dict()) == | ||
training_job_config) | ||
|
||
def test_management_user(self) -> None: | ||
""" | ||
Tests creation and dict conversion of the ManagementUser DAO | ||
:return: None | ||
""" | ||
|
||
management_user = ManagementUser(username="test1", password="test2", email="[email protected]", first_name="test3", | ||
last_name="test4", organization="testi", admin=False, salt="test") | ||
|
||
assert isinstance(management_user.to_dict(), dict) | ||
assert isinstance(ManagementUser.from_dict(management_user.to_dict()), | ||
ManagementUser) | ||
assert (ManagementUser.from_dict(management_user.to_dict()).to_dict() == | ||
management_user.to_dict()) | ||
assert (ManagementUser.from_dict(management_user.to_dict()) == | ||
management_user) | ||
|
||
def test_session_token(self) -> None: | ||
""" | ||
Tests creation and dict conversion of the SessionToken DAO | ||
:return: None | ||
""" | ||
|
||
session_token = SessionToken(token="test_token", timestamp=11.11, username="test") | ||
assert isinstance(session_token.to_dict(), dict) | ||
assert isinstance(SessionToken.from_dict(session_token.to_dict()), | ||
SessionToken) | ||
assert (SessionToken.from_dict(session_token.to_dict()).to_dict() == | ||
session_token.to_dict()) | ||
assert (SessionToken.from_dict(session_token.to_dict()) == | ||
session_token) |
42 changes: 42 additions & 0 deletions
42
simulation-system/libs/csle-common/tests/test_management_dao.py
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,42 @@ | ||
from csle_common.dao.management.management_user import ManagementUser | ||
from csle_common.dao.management.session_token import SessionToken | ||
|
||
|
||
class TestManagementDaoSuite: | ||
""" | ||
Test suite for management data access objects (DAOs) | ||
""" | ||
|
||
def test_management_user(self) -> None: | ||
""" | ||
Tests creation and dict conversion of the ManagementUser DAO | ||
:return: None | ||
""" | ||
|
||
management_user = ManagementUser(username="test1", password="test2", email="[email protected]", first_name="test3", | ||
last_name="test4", organization="testi", admin=False, salt="test") | ||
|
||
assert isinstance(management_user.to_dict(), dict) | ||
assert isinstance(ManagementUser.from_dict(management_user.to_dict()), | ||
ManagementUser) | ||
assert (ManagementUser.from_dict(management_user.to_dict()).to_dict() == | ||
management_user.to_dict()) | ||
assert (ManagementUser.from_dict(management_user.to_dict()) == | ||
management_user) | ||
|
||
def test_session_token(self) -> None: | ||
""" | ||
Tests creation and dict conversion of the SessionToken DAO | ||
:return: None | ||
""" | ||
|
||
session_token = SessionToken(token="test_token", timestamp=11.11, username="test") | ||
assert isinstance(session_token.to_dict(), dict) | ||
assert isinstance(SessionToken.from_dict(session_token.to_dict()), | ||
SessionToken) | ||
assert (SessionToken.from_dict(session_token.to_dict()).to_dict() == | ||
session_token.to_dict()) | ||
assert (SessionToken.from_dict(session_token.to_dict()) == | ||
session_token) |