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

[Feature]: Add integration tests with real API endpoints #28

Closed
3 tasks done
PPeitsch opened this issue Nov 23, 2024 · 0 comments · Fixed by #46
Closed
3 tasks done

[Feature]: Add integration tests with real API endpoints #28

PPeitsch opened this issue Nov 23, 2024 · 0 comments · Fixed by #46
Labels
enhancement New feature or request

Comments

@PPeitsch
Copy link
Owner

PPeitsch commented Nov 23, 2024

⚡ [Feature]: Add integration tests with real API endpoints

Guidelines

  • I agree to follow this project's Contributing Guidelines
  • I have searched for similar feature requests
  • I understand that this is a request and implementation is not guaranteed

Problem Description

The project currently lacks integration tests that validate the connector's behavior against real BCRA API endpoints. While unit tests with mocks exist, we need to verify actual API interactions.

Proposed Solution

Implement comprehensive integration tests:

@pytest.mark.integration
class TestBCRAIntegration:
    @pytest.fixture(autouse=True)
    def setup(self):
        self.connector = BCRAConnector(
            verify_ssl=False,
            rate_limit=RateLimitConfig(calls=10, period=1.0)
        )

    def test_full_workflow(self):
        """Test complete API workflow."""
        variables = self.connector.get_principales_variables()
        assert len(variables) > 0
        
        # Test historical data
        if variables:
            data = self.connector.get_datos_variable(
                variables[0].idVariable,
                datetime.now() - timedelta(days=30),
                datetime.now()
            )
            assert len(data) > 0

Alternative Solutions

  1. Use VCR pattern to record and replay API responses
  2. Implement a mock BCRA API server for testing
  3. Use a staging environment if available

Additional Context

Integration tests should verify:

  • All API endpoints
  • Error handling with real API responses
  • Rate limiting behavior
  • Timeout scenarios
  • Full workflow scenarios

Implementation Details

Required components:

  1. Test Configuration:

    • Environment variables support
    • Rate limit settings
    • Timeout configuration
    • Skip markers for CI/CD
  2. Test Categories:

    • API endpoint verification
    • Error handling scenarios
    • Rate limiting tests
    • Full workflow tests
  3. CI/CD Integration:

    • Skip options for integration tests
    • Separate test running configurations
    • Documentation for test execution
@PPeitsch PPeitsch added the enhancement New feature or request label Nov 23, 2024
PPeitsch added a commit that referenced this issue Dec 20, 2024
- Add from_dict classmethod to Entidad for proper data mapping
- Update get_entidades to use from_dict instead of direct kwargs
- Fix API response field mapping from 'codigoEntidad' to 'codigo_entidad'
- Maintain consistency with project's data model patterns
See also: #28
@PPeitsch PPeitsch linked a pull request Dec 20, 2024 that will close this issue
17 tasks
@PPeitsch PPeitsch linked a pull request Dec 28, 2024 that will close this issue
17 tasks
@PPeitsch PPeitsch linked a pull request Dec 29, 2024 that will close this issue
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant