Skip to content

Commit

Permalink
CASMCMS-8905: Remove BOS v2 sessions update commands; add test to ver…
Browse files Browse the repository at this point in the history
…ify same
  • Loading branch information
mharding-hpe committed Feb 5, 2024
1 parent 082288e commit b4dee91
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cray/modules/bos/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2020-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2020-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -38,6 +38,9 @@

cli = generate(__file__, swagger_opts=SWAGGER_OPTS)

# Update v2 sessions should only be in the API -- not intended for CLI use
del cli.commands['v2'].commands['sessions'].commands['update']

# Place the v2 commands at the 'cray bos' level of the cli
CURRENT_VERSION = 'v2'
PRESERVE_VERSIONS = True
Expand Down
27 changes: 26 additions & 1 deletion cray/tests/test_modules/test_bos.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2020-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2020-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -271,6 +271,31 @@ def test_cray_bos_session_create(cli_runner, rest_mock):
}, data['body']
)


def test_cray_bos_sessions_base(cli_runner, rest_mock):
""" Test cray bos session base command """
runner, cli, _ = cli_runner
result = runner.invoke(cli, ['bos', 'sessions'])
assert result.exit_code == 0

outputs = ['Groups:', 'status', 'Commands:', 'create', 'delete',
'describe', 'list']
for txt in outputs:
assert txt in result.output


def test_cray_bos_v2_sessions_base(cli_runner, rest_mock):
""" Test cray bos v2 session base command """
runner, cli, _ = cli_runner
result = runner.invoke(cli, ['bos', 'v2', 'sessions'])
assert result.exit_code == 0

outputs = ['Groups:', 'status', 'Commands:', 'create', 'delete',
'describe', 'list']
for txt in outputs:
assert txt in result.output


# pylint: disable=redefined-outer-name
def test_cray_bos_v2_sessions_create(cli_runner, rest_mock):
""" Test cray bos create v2 session ... happy path """
Expand Down

0 comments on commit b4dee91

Please sign in to comment.