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 a google calendar diagnostics platform #101175
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Oh interesting, I considered these codecov failures advisory/up to judgement. These are corner cases for internal details about the storage format of the integration that didn't seem worth testing since you have to patch them to get into these weird states. Happy to add that coverage though. |
I simplified the code to just handle these cases inline rather than create code branches. Kind of a codecov hack, but the code is a bit simpler in the end. |
@allenporter Don't forget to mark it ready for review when it is done 😉 |
Thank you -- didn't want to spam before it actually passed, but then of course forgot to re-check. |
@@ -58,6 +58,35 @@ | |||
"defaultReminders": [], | |||
} | |||
|
|||
TEST_EVENT = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a fixture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice, but options :)
Maybe for a future PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post merge, following up on the fixture comment since i'm happy to explore it in a future PR.
This is used with mock_events_list_items
which is a fixture. That is used at different points in the test to change the next response when events are listed, so the API is now something like:
mock_events_list_items([TEST_EVENT])
or if testing a special case, something like this:
mock_events_list_items(
[
{
**TEST_EVENT,
"id": "event-id-1",
"iCalUID": "event-id-1@google.com",
"summary": "All Day Event",
"start": {"date": "2022-10-08"},
"end": {"date": "2022-10-09"},
},
]
)
or for tests that are not using freezer:
one_hour_from_now = dt_util.now() + datetime.timedelta(minutes=30)
end_event = one_hour_from_now + datetime.timedelta(minutes=60)
event = {
**TEST_EVENT,
"start": {"dateTime": one_hour_from_now.isoformat()},
"end": {"dateTime": end_event.isoformat()},
}
mock_events_list_items([event])
So its definitely used as an input to a fixture, but its just a variable to help with creating new events for composing them.
So at best we could make another fixture that is a simpler fixture that already takes in the TEST_EVENT as a default and the caller passes in the deltas for the test, but I didn't think having multiple fixtures was worthwhile, and so that is why its composition via TEST_EVENT
If you have other ideas happy to explore them, but also this isn't a pain right now.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @allenporter 👍
../Frenck
Proposed change
Add a google calendar diagnostics platform which includes redacted events.
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: