Skip to content

Commit

Permalink
[cli-sessions] unittests for ssh-server and serial-console commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
i-davydenko committed May 28, 2024
1 parent d571367 commit 209438b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7753,7 +7753,7 @@ def notice(db, category_list, max_events, namespace):
#
# 'serial_console' group ('config serial_console')
#
@config.group()
@config.group(cls=clicommon.AbbreviationGroup, name='serial_console')
def serial_console():
"""Configuring system serial-console behavior"""
pass
Expand Down Expand Up @@ -7786,7 +7786,7 @@ def inactivity_timeout_serial(inactivity_timeout):
#
# 'ssh' group ('config ssh')
#
@config.group()
@config.group(cls=clicommon.AbbreviationGroup, name='ssh')
def ssh():
"""Configuring system ssh behavior"""
pass
Expand Down
32 changes: 32 additions & 0 deletions tests/cli_sessions_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from click.testing import CliRunner

import config.main as config
import show.main as show
from utilities_common.db import Db


class TestCliSessionsCommands:
def test_config_command(self):
runner = CliRunner()

db = Db()

result = runner.invoke(config.config.commands['serial_console'].commands['sysrq-capabilities'],
['enabled'], obj=db)
assert result.exit_code == 0

result = runner.invoke(config.config.commands['serial_console'].commands['inactivity-timeout'],
[180], obj=db)
assert result.exit_code == 0

result = runner.invoke(show.cli.commands['serial_console'], obj=db)
assert result.exit_code == 0

result = runner.invoke(config.config.commands['ssh'].commands['inactivity-timeout'], [190], obj=db)
assert result.exit_code == 0

result = runner.invoke(config.config.commands['ssh'].commands['max-sessions'], [60], obj=db)
assert result.exit_code == 0

result = runner.invoke(show.cli.commands['ssh'], obj=db)
assert result.exit_code == 0

0 comments on commit 209438b

Please sign in to comment.