Write tests that verify actual system behavior rather than implementation details by minimizing mock usage and focusing on real interactions. Excessive mocking can lead to brittle tests that pass even when core functionality is broken.
Write tests that verify actual system behavior rather than implementation details by minimizing mock usage and focusing on real interactions. Excessive mocking can lead to brittle tests that pass even when core functionality is broken.
Key guidelines:
Example - Instead of:
@patch("sentry.api.endpoints.seer_rpc.integration_service.get_organization_integrations")
@patch("sentry.api.endpoints.seer_rpc.options.get")
def test_complex_scenario(self, mock_options, mock_integrations):
mock_integrations.return_value = []
mock_options.return_value = []
# Test implementation
Prefer:
@override_options({"feature.flag": True})
def test_complex_scenario(self):
# Create real integration
integration = self.create_integration(
organization=self.organization,
provider="github"
)
# Test actual behavior
This approach produces more reliable tests that better verify system correctness and are easier to maintain.
Enter the URL of a public GitHub repository