-
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
1 changed file
with
36 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 |
---|---|---|
|
@@ -34,6 +34,8 @@ | |
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: | ||
|
@@ -176,3 +178,37 @@ 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) |