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

test: Add unit testing #1677

Draft
wants to merge 160 commits into
base: master
Choose a base branch
from
Draft

test: Add unit testing #1677

wants to merge 160 commits into from

Conversation

BobDotCom
Copy link
Member

@BobDotCom BobDotCom commented Oct 7, 2022

Summary

Implements unit testing

Todo

  • Initial Framework
    • Ability to intercept requests and track them
    • Support blocking requests from going through to discord
    • Ability to set a mock response for a request
    • Request data tracking:
      • Query parameters
      • Request Headers
      • Request body
    • Mock login support (Eliminate usage of real bot token & required login)
    • Gateway support (Preferably mocked)
  • Move to discord.ext.testing
    • Support internal testing
    • Support user (bot-maker) testing
    • Documentation
      • Contribution guide
      • Library user guide
        • Short overview in docs toctree/index
        • Detailed walk-through on the guide
  • Finish internal tests
    • Initial goal: 50% Coverage

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.

FrostByte266 and others added 23 commits September 1, 2021 22:53
- Added middlewareplugin.py, this contains the proxy.py plugin that will
  intercept requests for you
- Added tests.py, this contains the base test case and one "test" test
- Added a makefile to help with cert generation and environment vars
- Added a readme file
- Created a custom request dataclass
- Updated .gitignore to ignore env files and cert files
- Made some changes to discord/http.py to facilitate functionality
  during testing
- Fixed the request blocking system in proxy
- Fixed the middleware dumping requests into queue as two different
  requests
- Changed the middleware plugin to selectively dump only requests that
  are explicitely made through the `proxied_request` test method
- Added logging to the middleware and test file
Fixed a spelling error
Corrected types from HttpParser to the new CombinedHttpRequest
Added method docstrings
Added comments and ignore some faulty type checker errors
# Conflicts:
#	.gitignore
#	discord/http.py
@Lulalaby Lulalaby closed this Jan 5, 2023
@Lulalaby Lulalaby reopened this Jan 5, 2023
@Lulalaby Lulalaby added this to the v2.6 milestone Feb 28, 2024
@Dorukyum Dorukyum removed the on hold label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high High Priority status: in progress Work in Progess
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants