Open terriko opened 2 months ago
This may require some reading to make sure you understand how to use pytest and how to call the correct code, but I think it should be beginner-friendly so I'm tagging it as a "good first issue" and will put the new contributor tips below. I'm also tagging it for hacktoberfest. If you're interested in doing this as part of the contest, make sure you do it within their timeframe and follow their rules. (Most notably: don't create the PR before October 1 or it won't count)
Short tips for new contributors:
Claiming issues:
Hey... I would like to work on this issue...
@Malay-dev Are you still working on this? Did you need some help?
yep... I am still figuring out the pytest docs
def test_unset_sbom_serial_number(self):
# Create a test case with sbom_serial_number unset
test_data = {
# Other required fields...
"sbom_serial_number": None
}
# Attempt to run output_engine_init with the test data
with self.assertRaises(Exception): # Adjust the exception type as needed
output_engine_init(**test_data)
Hey @terriko Can you give some more guidance such as where I should make this test file and how can I test it after writing the test?
The bug in #4438 happened because of an unset serial number, and a fix is in progress in #4440
What I'd like is some improved tests for unset data in output_engine so this doesn't happen again, so I want a test that tries to run
output_engine/__init__.py
with various values not set.I have a feeling that any test that cycles through all the possible fields will right now find a few bugs, so we may want to start with just
sbom_serial_number
but design it so that we can have a parameter test with any given field unset so eventually all possible fields will be tested.