discord-modmail / modmail

A Modmail bot for Discord. Allowing safe moderator conversations with server members one server at a time.
https://discord-modmail.readthedocs.io/
MIT License
15 stars 8 forks source link

more tests #68

Closed onerandomusername closed 2 years ago

onerandomusername commented 3 years ago

Description

Continues expanding the test suite. This attempts to cover some parts of the already installed portions.

codecov[bot] commented 3 years ago

Codecov Report

Merging #68 (3d6b29d) into main (4aa8091) will increase coverage by 24.22%. The diff coverage is 92.72%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main      #68       +/-   ##
===========================================
+ Coverage   33.07%   57.29%   +24.22%     
===========================================
  Files          17       23        +6     
  Lines         898     1042      +144     
  Branches      134      140        +6     
===========================================
+ Hits          297      597      +300     
+ Misses        587      424      -163     
- Partials       14       21        +7     
Impacted Files Coverage Δ
tests/modmail/extensions/test_plugin_manager.py 77.77% <77.77%> (ø)
modmail/bot.py 37.28% <100.00%> (+3.95%) :arrow_up:
modmail/extensions/utils/error_handler.py 23.57% <100.00%> (+23.57%) :arrow_up:
tests/modmail/extensions/test_extension_manager.py 100.00% <100.00%> (ø)
tests/modmail/test_bot.py 100.00% <100.00%> (ø)
tests/modmail/test_logs.py 100.00% <100.00%> (ø)
tests/modmail/utils/test_embeds.py 100.00% <100.00%> (ø)
modmail/__main__.py 0.00% <0.00%> (-56.25%) :arrow_down:
tests/modmail/utils/test_pagination.py 100.00% <0.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4aa8091...3d6b29d. Read the comment docs.

onerandomusername commented 2 years ago

This pr can be reviewed at any time, once it is reviewed, other tests will be added as seperate prs.

onerandomusername commented 2 years ago

The new changes look good, the original code taken from pydis hasn't been reviewed.

The original code has been changed a somewhat substantial amount. The test_mocks file was rewritten to use pytest rather than unittest. While pytest supports unittests out of the box, I did not see an advantage to having unittests and pytest in the project.

On the mocks themselves, the context mock was updated to use the proper references. This now means that ctx.channel.guild and ctx.guild are the same mock, when they were previously different. In addition, a discord.Thread mock was added.

The last major change is the hash method will bitshift ids larger than 22.

Shivansh-007 commented 2 years ago

The new changes look good, the original code taken from pydis hasn't been reviewed.

The original code has been changed a somewhat substantial amount. The test_mocks file was rewritten to use pytest rather than unittest. While pytest supports unittests out of the box, I did not see an advantage to having unittests and pytest in the project.

On the mocks themselves, the context mock was updated to use the proper references. This now means that ctx.channel.guild and ctx.guild are the same mock, when they were previously different. In addition, a discord.Thread mock was added.

The last major change is the hash method will bitshift ids larger than 22.

Yeah, I reviewed the changes commit-wise after the initial copy commit.

onerandomusername commented 2 years ago

The new changes look good, the original code taken from pydis hasn't been reviewed.

The original code has been changed a somewhat substantial amount. The test_mocks file was rewritten to use pytest rather than unittest. While pytest supports unittests out of the box, I did not see an advantage to having unittests and pytest in the project. On the mocks themselves, the context mock was updated to use the proper references. This now means that ctx.channel.guild and ctx.guild are the same mock, when they were previously different. In addition, a discord.Thread mock was added. The last major change is the hash method will bitshift ids larger than 22.

Yeah, I reviewed the changes commit-wise after the initial copy commit.

Ah, the hash, multiple docstring, discord.Thread, and any others that I may not be thinking of right now were added in the initial commit, so the diff might not be the most accurate check.