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

Add getting user from chat_boost #1474

Open
wants to merge 4 commits into
base: dev-3.x
Choose a base branch
from

Conversation

Desiders
Copy link
Contributor

@Desiders Desiders commented May 1, 2024

Close: #1472

@github-actions github-actions bot added the 3.x Issue or PR for stable 3.x version label May 1, 2024
Copy link

github-actions bot commented May 1, 2024

✔️ Changelog found.

Thank you for adding a description of the changes

Copy link

codecov bot commented May 1, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 99.99%. Comparing base (f1c9fc5) to head (e6e2a8a).
Report is 3 commits behind head on dev-3.x.

❗ Current head e6e2a8a differs from pull request most recent head 94cff57. Consider uploading reports for the commit 94cff57 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           dev-3.x    #1474      +/-   ##
===========================================
- Coverage   100.00%   99.99%   -0.01%     
===========================================
  Files          422      422              
  Lines        10937    10939       +2     
===========================================
+ Hits         10937    10938       +1     
- Misses           0        1       +1     
Flag Coverage Δ
unittests 99.99% <66.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
aiogram/dispatcher/middlewares/user_context.py 98.76% <66.66%> (-1.24%) ⬇️

@Olegt0rr
Copy link
Contributor

Olegt0rr commented May 1, 2024

@Desiders, please add some related tests

@Olegt0rr Olegt0rr self-requested a review May 1, 2024 19:15
@Desiders
Copy link
Contributor Author

Desiders commented May 3, 2024

@Desiders, please add some related tests

I added this, but I'm not sure that this test is right in this case

Comment on lines +72 to +87
source = ChatBoostSourceGiftCode(user=user)
boost = ChatBoost(boost_id="Test", add_date=add_date, expiration_date=expiration_date, source=source)
update = Update(update_id=42, chat_boost=ChatBoostUpdated(chat=chat, boost=boost))

await middleware(next_handler, update, data)

event_context = data["event_context"]
assert isinstance(event_context, EventContext)
assert event_context.chat is chat
assert event_context.user is None
assert event_context.thread_id is None
assert data["event_chat"] is chat
assert data.get("event_from_user") is None
assert data.get("event_thread_id") is None

data.clear()
Copy link
Contributor

Choose a reason for hiding this comment

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

Use parametrize to repeat the test with other params

Copy link
Contributor

Choose a reason for hiding this comment

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

Also try to find other tests covering neighbour data in context. Looks like we just need to add params to existing test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand what you mean by

Looks like we just need to add params to existing test

test_call test or the test that I wrote?
I don't see the point in the first test and how to cover the current case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issue or PR for stable 3.x version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get user from chat_boost with source ChatBoostSourcePremium
2 participants