Skip to content

Commit 2fb550f

Browse files
feat: add room_id param to createRoom API (ietf-tools#7308)
* feat: add room_id param to createRoom API * test: update tests_helpers.py
1 parent 279fb85 commit 2fb550f

4 files changed

Lines changed: 26 additions & 15 deletions

File tree

ietf/meeting/helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,7 @@ def create_interim_session_conferences(sessions):
10991099
try:
11001100
confs = meetecho_manager.create(
11011101
group=session.group,
1102+
session_id=session.pk,
11021103
description=str(session),
11031104
start_time=ts.utc_start_time(),
11041105
duration=ts.duration,

ietf/meeting/tests_helpers.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def test_create_interim_session_conferences(self, mock):
487487
mock.reset_mock()
488488
mock_conf_mgr.create.return_value = [
489489
Conference(
490-
manager=mock_conf_mgr, id=1, public_id='some-uuid', description='desc',
490+
manager=mock_conf_mgr, id=int(sessions[0].pk), public_id='some-uuid', description='desc',
491491
start_time=timeslots[0].utc_start_time(), duration=timeslots[0].duration, url='fake-meetecho-url',
492492
deletion_token='please-delete-me',
493493
),
@@ -498,6 +498,7 @@ def test_create_interim_session_conferences(self, mock):
498498
mock_conf_mgr.create.call_args[1],
499499
{
500500
'group': sessions[0].group,
501+
'session_id': sessions[0].id,
501502
'description': str(sessions[0]),
502503
'start_time': timeslots[0].utc_start_time(),
503504
'duration': timeslots[0].duration,
@@ -512,12 +513,12 @@ def test_create_interim_session_conferences(self, mock):
512513
mock.reset_mock()
513514
mock_conf_mgr.create.side_effect = [
514515
[Conference(
515-
manager=mock_conf_mgr, id=1, public_id='some-uuid', description='desc',
516+
manager=mock_conf_mgr, id=int(sessions[0].pk), public_id='some-uuid', description='desc',
516517
start_time=timeslots[0].utc_start_time(), duration=timeslots[0].duration, url='different-fake-meetecho-url',
517518
deletion_token='please-delete-me',
518519
)],
519520
[Conference(
520-
manager=mock_conf_mgr, id=2, public_id='another-uuid', description='desc',
521+
manager=mock_conf_mgr, id=int(sessions[1].pk), public_id='another-uuid', description='desc',
521522
start_time=timeslots[1].utc_start_time(), duration=timeslots[1].duration, url='another-fake-meetecho-url',
522523
deletion_token='please-delete-me-too',
523524
)],
@@ -528,16 +529,18 @@ def test_create_interim_session_conferences(self, mock):
528529
mock_conf_mgr.create.call_args_list,
529530
[
530531
({
531-
'group': sessions[0].group,
532-
'description': str(sessions[0]),
533-
'start_time': timeslots[0].utc_start_time(),
534-
'duration': timeslots[0].duration,
532+
'group': sessions[0].group,
533+
'session_id': sessions[0].id,
534+
'description': str(sessions[0]),
535+
'start_time': timeslots[0].utc_start_time(),
536+
'duration': timeslots[0].duration,
535537
},),
536538
({
537-
'group': sessions[1].group,
538-
'description': str(sessions[1]),
539-
'start_time': timeslots[1].utc_start_time(),
540-
'duration': timeslots[1].duration,
539+
'group': sessions[1].group,
540+
'session_id': sessions[1].id,
541+
'description': str(sessions[1]),
542+
'start_time': timeslots[1].utc_start_time(),
543+
'duration': timeslots[1].duration,
541544
},),
542545
]
543546
)

ietf/utils/meetecho.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def retrieve_wg_tokens(self, acronyms: Union[str, Sequence[str]]):
115115
def schedule_meeting(
116116
self,
117117
wg_token: str,
118+
room_id: int,
118119
description: str,
119120
start_time: datetime.datetime,
120121
duration: datetime.timedelta,
@@ -139,6 +140,7 @@ def schedule_meeting(
139140
}
140141
141142
:param wg_token: token retrieved via retrieve_wg_tokens()
143+
:param room_id: int id to identify the room (will be echoed as room.id)
142144
:param description: str describing the meeting
143145
:param start_time: starting time as a datetime
144146
:param duration: duration as a timedelta
@@ -151,6 +153,7 @@ def schedule_meeting(
151153
"meeting/interim/createRoom",
152154
api_token=wg_token,
153155
json={
156+
"room_id": room_id,
154157
"description": description,
155158
"start_time": self._serialize_time(start_time),
156159
"duration": self._serialize_duration(duration),
@@ -455,9 +458,10 @@ def fetch(self, group):
455458
response = self.api.fetch_meetings(self.wg_token(group))
456459
return Conference.from_api_dict(self, response["rooms"])
457460

458-
def create(self, group, description, start_time, duration, extrainfo=""):
461+
def create(self, group, session_id, description, start_time, duration, extrainfo=""):
459462
response = self.api.schedule_meeting(
460463
wg_token=self.wg_token(group),
464+
room_id=int(session_id),
461465
description=description,
462466
start_time=start_time,
463467
duration=duration,

ietf/utils/tests_meetecho.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_schedule_meeting(self):
8282
'rooms': {
8383
'3d55bce0-535e-4ba8-bb8e-734911cf3c32': {
8484
'room': {
85-
'id': 18,
85+
'id': 18, # should match room_id in api.schedule_meeting() below
8686
'start_time': '2021-09-14 10:00:00',
8787
'duration': 130,
8888
'description': 'interim-2021-wgname-01',
@@ -97,6 +97,7 @@ def test_schedule_meeting(self):
9797
api = MeetechoAPI(API_BASE, CLIENT_ID, CLIENT_SECRET)
9898
api_response = api.schedule_meeting(
9999
wg_token='my-token',
100+
room_id=18,
100101
start_time=datetime.datetime(2021, 9, 14, 10, 0, 0, tzinfo=datetime.timezone.utc),
101102
duration=datetime.timedelta(minutes=130),
102103
description='interim-2021-wgname-01',
@@ -116,6 +117,7 @@ def test_schedule_meeting(self):
116117
self.assertEqual(
117118
request.json(),
118119
{
120+
'room_id': 18,
119121
'duration': 130,
120122
'start_time': '2021-09-14 10:00:00',
121123
'extrainfo': 'message for staff',
@@ -485,7 +487,7 @@ def test_create(self, mock_schedule, _):
485487
'rooms': {
486488
'session-1-uuid': {
487489
'room': {
488-
'id': 1,
490+
'id': 1, # value should match session_id param to cm.create() below
489491
'start_time': datetime.datetime(2022,2,4,1,2,3, tzinfo=datetime.timezone.utc),
490492
'duration': datetime.timedelta(minutes=45),
491493
'description': 'some-description',
@@ -496,7 +498,7 @@ def test_create(self, mock_schedule, _):
496498
},
497499
}
498500
cm = ConferenceManager(settings.MEETECHO_API_CONFIG)
499-
result = cm.create('group', 'desc', 'starttime', 'dur', 'extra')
501+
result = cm.create('group', '1', 'desc', 'starttime', 'dur', 'extra')
500502
self.assertEqual(
501503
result,
502504
[Conference(
@@ -515,6 +517,7 @@ def test_create(self, mock_schedule, _):
515517
kwargs,
516518
{
517519
'wg_token': 'atoken',
520+
'room_id': 1,
518521
'description': 'desc',
519522
'start_time': 'starttime',
520523
'duration': 'dur',

0 commit comments

Comments
 (0)