Skip to content

Conversation

@kensager
Copy link

@kensager kensager commented Dec 2, 2025

Description

Implementation for the Ticket API. While the issue itself was closed as "not enough interest," our group has been using the attached tickets.py for a couple of years now. Today I took the time to apply some updates, develops some tests, and bring our use-case to the community. Ultimately my goal is upstream integration so we can stop cherry-picking commits into new versions.

There are a couple of components I could use some help with too.

  • I don't know anything about this pytest-vcr stuff or how to generate/properly convert the live tests. I've been doing live testing against a TSC server.
  • The testing documentation seems to be a little bit out-of-date, it looks like there was something called 'cloudbees' which replaced something? Similarly I've been testing using API keys instead of user/passwords. In part because our setup is a MFA'd SSO configuration.
  • The PR template mentions things like 'style guide' but I don't see a CONTRIBUTING.md, so I'm not sure what style is in use? Or what, if any, linters should be used? I suppose the template may be a default of some sort as well. But, given this, I'd like to apologize for the lack of checked off checklist items.

I don't do much development nowadays and I've likely done

Fixes #23

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

Tested by:

  1. Creating API key for user
  2. Making some minor modifications for conftest.py. Not included in this PR because I'm wasn't sure if I should be mangling any testing processes. I can add these if desirable, they're just some os.getenv shortcuts that attach accesskey/secret when present.
  3. Running pytest --disable-vcr --cov=tenable.sc tests/sc/test_tickets.py

Question: The original Implementor has a comment pointing out that tickets need to be set to 'Resolved' to be eventually purged. I've opted to 'finalize' them by marking them 'Closed' per Ticket PATCH documentation. Which option is "most" correct? Or if its 6 in one hand and 7 in the other, that's fine too.

Test Configuration:

  • Python Version(s) Tested:
platform linux -- Python 3.11.9, pytest-8.4.2, pluggy-1.6.0
rootdir: ./pyTenable/tests
configfile: pytest.ini
plugins: vcr-1.0.2, cov-7.0.0, datafiles-3.0.0, anyio-4.11.0
  • Tenable.sc version (if necessary):
    Version: 6.4.5
    Server Build ID: 20240829180641

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@kensager kensager requested a review from a team as a code owner December 2, 2025 05:23
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.

TSC TicketAPI

2 participants