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

Adding basic test suite #21

Closed
mlodic opened this issue Jan 2, 2022 · 4 comments
Closed

Adding basic test suite #21

mlodic opened this issue Jan 2, 2022 · 4 comments
Assignees
Milestone

Comments

@mlodic
Copy link
Member

mlodic commented Jan 2, 2022

We should properly mock the query to ElasticSearch to have the tests work in Github Actions. Please refer to IntelOwl to get an example

@uzaxirr
Copy link
Contributor

uzaxirr commented Feb 5, 2022

Could you enlighten me on the purpose of files currently present in tests/greedybear/cronjobs
I guess i just have to add a __init__.py file in the currently present tests directory to convert it into a module and add test for CRUD methods on existing models and test the API endpoints.

or do i have to make utils for APIView

Please correct me if i'm wrong in any of the above

@mlodic
Copy link
Member Author

mlodic commented Feb 7, 2022

well, actually there are not tests enabled in the CI (see pull_request_automation.yml).

As you mentioned, in that folder there are some tests but:

  • they only work if manually launched because they require to have an ElasticSearch instance with the right data active and connected. This is why I asked to mock ElasticSearch connections (fake them and have them return fake data so the code would correctly execute until its end) to have the tests working even in the Github CI.
  • those tests are only for the cronjobs part (interaction with ElasticSearch). As you mentioned, there are no tests for the API endpoints and we should add them (something very similar to the tests for the APIs in IntelOwl)

@uzaxirr
Copy link
Contributor

uzaxirr commented Feb 7, 2022

Cool seems fine, can you assign it to me as my current PR is under-review from a long time so would work on this one parallelly.

@mlodic mlodic added this to the 1.0.0 milestone Feb 11, 2022
@mlodic
Copy link
Member Author

mlodic commented Apr 1, 2022

dolved in #38

@mlodic mlodic closed this as completed Apr 1, 2022
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

No branches or pull requests

2 participants