Skip to content

fix: resolve TypeError in TLS verification unit tests-#1414#2040

Merged
utksh1 merged 1 commit into
utksh1:mainfrom
Rakshak05:issue-#1414-new
Jul 20, 2026
Merged

fix: resolve TypeError in TLS verification unit tests-#1414#2040
utksh1 merged 1 commit into
utksh1:mainfrom
Rakshak05:issue-#1414-new

Conversation

@Rakshak05

@Rakshak05 Rakshak05 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Closes #1414

Description

This PR resolves the TypeError: 'coroutine' object does not support the asynchronous context manager protocol failure in the TLS verification unit tests.

Key Changes:

  • Crawler Tests: Mocked the client.stream async context manager and the aiter_bytes generator in TestCrawlerVerifySsl to match the new client.stream implementation in crawler.py.
  • API Scanner Tests: Mocked the crawl_target function inside the TestAPIScannerVerifySsl tests to isolate the API scanner testing flow and avoid running the actual client stream method.

Related Issues

Closes #1736 (TLS verification regression tests)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Ran the backend unit tests locally using:

pytest testing/backend/unit/test_tls_verification.py

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean test fix. Updates TLS verification test mocks to match the actual crawler.py implementation:

  • Mock client.stream async context manager instead of client.get
  • Add mock_aiter_bytes generator for streaming response
  • Mock crawl_target in API scanner tests for isolation

All CI passing. Merging.

@utksh1
utksh1 merged commit 4f9416b into utksh1:main Jul 20, 2026
18 checks passed
@utksh1 utksh1 added type:testing Testing work category bonus label area:backend Backend API, database, or service work level:intermediate 35 pts difficulty label for moderate contributor PRs gssoc:approved Admin validation: approved for GSSoC scoring labels Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend API, database, or service work gssoc:approved Admin validation: approved for GSSoC scoring level:intermediate 35 pts difficulty label for moderate contributor PRs type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TEST] Add Background component rendering contract tests

2 participants