Skip to content

Commit

Permalink
add method and test webinar report
Browse files Browse the repository at this point in the history
  • Loading branch information
sharinetmc committed Dec 13, 2024
1 parent b943598 commit 4081d8e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 3 deletions.
28 changes: 25 additions & 3 deletions parsons/zoom/zoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def __process_poll_results(self, tbl: Table) -> Table:
tbl.remove_column("question_details")

# Unpack question values
tbl = tbl.unpack_dict("question_details_value", include_original=True, prepend=False)
tbl = tbl.unpack_dict(
"question_details_value", include_original=True, prepend=False
)

# Remove column from API response
tbl.remove_column("question_details_value")
Expand Down Expand Up @@ -219,7 +221,9 @@ def get_past_meeting_participants(self, meeting_id):
See :ref:`parsons-table` for output options.
"""

tbl = self._get_request(f"report/meetings/{meeting_id}/participants", "participants")
tbl = self._get_request(
f"report/meetings/{meeting_id}/participants", "participants"
)
logger.info(f"Retrieved {tbl.num_rows} participants.")
return tbl

Expand Down Expand Up @@ -255,6 +259,22 @@ def get_user_webinars(self, user_id):
logger.info(f"Retrieved {tbl.num_rows} webinars.")
return tbl

def get_webinar_report(self, webinar_id):
"""
Get past meeting participants
`Args:`
webinar_id: str
The webinar id
`Returns:`
Parsons Table
See :ref:`parsons-table` for output options.
"""

tbl = self._get_request(f"report/webinars/{webinar_id}")
logger.info(f"Retrieved {tbl.num_rows} webinar report.")
return tbl

def get_past_webinar_participants(self, webinar_id):
"""
Get past meeting participants
Expand All @@ -267,7 +287,9 @@ def get_past_webinar_participants(self, webinar_id):
See :ref:`parsons-table` for output options.
"""

tbl = self._get_request(f"report/webinars/{webinar_id}/participants", "participants")
tbl = self._get_request(
f"report/webinars/{webinar_id}/participants", "participants"
)
logger.info(f"Retrieved {tbl.num_rows} webinar participants.")
return tbl

Expand Down
43 changes: 43 additions & 0 deletions test/test_zoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,49 @@ def test_get_past_webinar_participants(self, m):
m.get(ZOOM_URI + "report/webinars/123/participants", json=participants)
assert_matching_tables(self.zoom.get_past_webinar_participants(123), tbl)

@requests_mock.Mocker()
def test_get_webinar_report(self, m):
report = {
"custom_keys": [{"key": "Host Nation", "value": "US"}],
"dept": "HR",
"duration": 2,
"end_time": "2022-03-15T07:42:22Z",
"id": 345678902224,
"participants_count": 4,
"start_time": "2022-03-15T07:40:46Z",
"topic": "My Meeting",
"total_minutes": 3,
"tracking_fields": [{"field": "Host Nation", "value": "US"}],
"type": 4,
"user_email": "[email protected]",
"user_name": "Jill Chill",
"uuid": "4444AAAiAAAAAiAiAiiAii==",
}
tbl = Table(
[
{
"custom_keys": [{"key": "Host Nation", "value": "US"}],
"dept": "HR",
"duration": 2,
"end_time": "2022-03-15T07:42:22Z",
"id": 345678902224,
"participants_count": 4,
"start_time": "2022-03-15T07:40:46Z",
"topic": "My Meeting",
"total_minutes": 3,
"tracking_fields": [{"field": "Host Nation", "value": "US"}],
"type": 4,
"user_email": "[email protected]",
"user_name": "Jill Chill",
"uuid": "4444AAAiAAAAAiAiAiiAii==",
}
]
)

m.post(ZOOM_AUTH_CALLBACK, json={"access_token": "fakeAccessToken"})
m.get(ZOOM_URI + "report/webinars/123", json=report)
assert_matching_tables(self.zoom.get_past_webinar_reports(123), tbl)

@requests_mock.Mocker()
def test_get_webinar_registrants(self, m):
registrants = {
Expand Down

0 comments on commit 4081d8e

Please sign in to comment.