Skip to content

unittests for API core file#1079

Closed
pUrGe12 wants to merge 5 commits intoOWASP:masterfrom
pUrGe12:tests-for-api-core
Closed

unittests for API core file#1079
pUrGe12 wants to merge 5 commits intoOWASP:masterfrom
pUrGe12:tests-for-api-core

Conversation

@pUrGe12
Copy link
Contributor

@pUrGe12 pUrGe12 commented Jun 7, 2025

Proposed change

These are unittest cases for API's core.py file.

Type of change

  • New core framework functionality
  • Bugfix (non-breaking change which fixes an issue)
  • Code refactoring without any functionality changes
  • New or existing module/payload change
  • Localization improvement
  • Dependency upgrade
  • Documentation improvement

Checklist

  • I've followed the contributing guidelines
  • I've run make pre-commit, it didn't generate any changes
  • I've run make test, all tests passed locally

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

LGTM

@patch("builtins.open", new_callable=mock_open, read_data="test_data")
def test_get_file_valid(self, mock_open):
Config.path.web_static_dir = os.getcwd()
filename = os.path.join(Config.path.web_static_dir, "test.txt")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest using Path for this kind of operations.

@pUrGe12
Copy link
Contributor Author

pUrGe12 commented Jun 9, 2025

My bad, ran into some git errors with this. I will make a new PR for this with the requested changes.

@pUrGe12 pUrGe12 closed this Jun 9, 2025
@pUrGe12 pUrGe12 mentioned this pull request Jun 9, 2025
10 tasks
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.

2 participants