pydo icon indicating copy to clipboard operation
pydo copied to clipboard

Add Mocked Tests: Apps (part 1)

Open danaelhe opened this issue 2 years ago • 3 comments

Overview Add more test coverage for Pydo, specifically for Apps

Mocked Tests: tests/mocked/ Tests in the mocked directory include:

  • Tests that validate the generated client has all the expected classes and methods for the respective API resources and operations.
  • Tests that exercise individual operations against mocked responses.

These tests do not act against the real API so no real resources are created.

To run mocked tests, run:

make test-mocked

Instructions

  1. Clone this repo.
  2. If you haven't already, install Python (version: >= 3.7.2) through their official installer.
  3. CD into the directory and run make install
  4. Create file: tests/mocked/test_uptime.py
  5. Add tests for apps. get_app_cpu_percentage_metrics , apps. get_app_restart_count_metrics_yml , apps.get_app_memory_percentage_metrics
  6. API documentation is here
  7. Pydo Documentation is here

danaelhe avatar Oct 20 '23 20:10 danaelhe

Hey @danaelhe . I would like to work on this issue. Can you please assign me to this? 🙂

Yordaniss avatar Oct 20 '23 22:10 Yordaniss

Hacktoberfest 2024 Contribution

Hello Maintainers,

I’m excited to contribute to the Pydo project for Hacktoberfest 2024! 🎉 This PR focuses on increasing test coverage for the Apps module, specifically by adding mocked tests.

Changes Made: Created tests/mocked/test_uptime.py. Added tests for the following functions: apps.get_app_cpu_percentage_metrics apps.get_app_restart_count_metrics_yml apps.get_app_memory_percentage_metrics Benefits: Enhanced Test Coverage: Ensures that all critical API functions are validated against mocked responses, improving reliability. No Impact on Real Resources: Tests run against mocks, ensuring safety and efficiency during testing. You can run the mocked tests using make test-mocked.

Thank you for considering this PR for Hacktoberfest 2024! you can assign the pr to me

P-Potdar avatar Oct 01 '24 19:10 P-Potdar

Hi @P-Potdar :dolphin: Could you please share the link to the PR you mentioned? We’d love to take a look at it. Thanks!

loosla avatar Oct 01 '24 19:10 loosla

Hi @loosla Should these test be written in the test_monitoring.py instead since they'll actually be testing methods of the Monitoring class?

I'd like to work on them.

giftcup avatar Oct 21 '24 11:10 giftcup

Hi @giftcup, you are right. Tests should be in pydo/tests/mocked/test_monitoring.py Good catch :rocket: I've updated the task description. Thanks.

loosla avatar Oct 21 '24 12:10 loosla