Scrapegraph-ai/tests
Tejas Amol Hande 320f13fa89
Enhance tests for FetchNode with mocking
This commit enhances the test suite for the FetchNode class by introducing mocking for the execute method using the unittest.mock module.

Changes:
- Imported the patch and MagicMock classes from unittest.mock.
- Decorated each test function with @patch('scrapegraphai.nodes.FetchNode.execute') to mock the execute method.
- Set the return_value of the mocked execute method to a MagicMock instance.
- Added assertions to check if the mocked execute method was called with the expected state dictionary.
- Updated the test functions to use the mocked execute method instead of the actual implementation.

Benefits:
- Improved test reliability by isolating the FetchNode class from external dependencies.
- Faster test execution since external resources (e.g., URLs, files) are not required.
- Better test coverage by testing the execute method's behavior with various input states.
- Increased maintainability by decoupling tests from the implementation details of the execute method.

The functionality of the FetchNode class remains unchanged, but the tests now use mocking to ensure the correct behavior of the execute method without relying on external resources or dependencies.
2024-06-07 23:11:32 +05:30
..
graphs test: Enhance JSON scraping pipeline test 2024-06-07 13:00:54 +05:30
nodes Enhance tests for FetchNode with mocking 2024-06-07 23:11:32 +05:30
utils feat(proxy-rotation): add parse (IP address) or search (from broker) functionality for proxy rotation 2024-05-10 21:09:48 +02:00
Readme.md refactoring of nodes 2024-04-24 21:13:27 +02:00

Test section

Regarding the tests for the folder graphs and nodes it was created a specific repo as a example (link of the repo). The test website is hosted here. Remember to activating Ollama and having installed the LLM on your pc

For running the tests run the command:

pytest