Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a feature to allow get and set of license from Tenable SC #845

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mark-carey-sap
Copy link

Added a feature to allow get and set of license from/to Tenable SC objects. This is used for automation since we install and rehydrate our environments from source periodically.

Description

This is a simple patch to expose licensing functionality for automation. It adds a license API object to the main Tenable SC object and provides a simple get/set method to allow the examination and setting of licenses in a non-GUI way.

Fixes # (issue)

Type of change

  • [ X ] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Get test functions
  • Set test of unlicensed product functions
  • Set test of licensed product replaces existing license functions

Test Configuration:

  • Python Version(s) Tested: 3.11.10
  • Tenable.sc version (if necessary): SecurityCenter-6.1.1-19.el8.x86_64

Checklist:

  • [ X ] My code follows the style guidelines of this project
  • [ X ] I have performed a self-review of my own code
  • [ X ] I have commented my code, particularly in hard-to-understand areas
  • [ X ] I have made corresponding changes to the documentation
  • I'm not sure where I need to change or add documentation. I've added what I believe to be the correct comments in the code. Please provide guidance if I've done this wrong. Thank you! 😄
  • [ X ] My changes generate no new warnings
  • [ X ] I have added tests that prove my fix is effective or that my feature works
  • [ X ] New and existing unit tests pass locally with my changes
  • [ X ] Any dependent changes have been merged and published in downstream modules

… Center objects. This is used for automation since we install and rehydrate our environments from source periodically.
@mark-carey-sap mark-carey-sap requested a review from a team as a code owner November 13, 2024 16:40
@aghassemlouei
Copy link

This pull request addresses a git issue I just opened #848 so please let me know if there is anything I can do to help move this forward! Thank you @mark-carey-sap for adding this; we really could benefit from it!

Copy link
Contributor

@SteveMcGrath SteveMcGrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently missing any unit tests for the proposed module. Otherwise looks good.

tenable/sc/license.py Outdated Show resolved Hide resolved
tenable/sc/license.py Outdated Show resolved Hide resolved
mark-carey-sap and others added 2 commits November 22, 2024 11:12
Constancy is good.  Agreed.

Co-authored-by: Steven McGrath <[email protected]>
Consistency is good.  Agreed.

Co-authored-by: Steven McGrath <[email protected]>
@mark-carey-sap
Copy link
Author

Currently missing any unit tests for the proposed module. Otherwise looks good.

I'm at a bit of a loss on how to Unit test this one. It would require a valid license to make any sense of the responses. If you have a way that I'm not seeing, please let me know and I'll be happy to implement it. We could certainly test for the expected failure, but success is the check that matters 😁 . Thanks for considering this one.

@aghassemlouei
Copy link

Following up on this pull request to see if we can get this into main or clarity regarding how to create unit tests for this sort of a capability.

@SteveMcGrath
Copy link
Contributor

I do not think you’d need a valid license, simply some dummy data to ensure some of the responses are accurate. The newer tests with the responses library are great examples.

I am currently on PTO this week, so if you need specific examples I can get them to you next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants