feat: add room_id param to createRoom API (#7308)
* feat: add room_id param to createRoom API * test: update tests_helpers.py
This commit is contained in:
parent
279fb8565a
commit
2fb550ffce
|
@ -1099,6 +1099,7 @@ def create_interim_session_conferences(sessions):
|
|||
try:
|
||||
confs = meetecho_manager.create(
|
||||
group=session.group,
|
||||
session_id=session.pk,
|
||||
description=str(session),
|
||||
start_time=ts.utc_start_time(),
|
||||
duration=ts.duration,
|
||||
|
|
|
@ -487,7 +487,7 @@ class InterimTests(TestCase):
|
|||
mock.reset_mock()
|
||||
mock_conf_mgr.create.return_value = [
|
||||
Conference(
|
||||
manager=mock_conf_mgr, id=1, public_id='some-uuid', description='desc',
|
||||
manager=mock_conf_mgr, id=int(sessions[0].pk), public_id='some-uuid', description='desc',
|
||||
start_time=timeslots[0].utc_start_time(), duration=timeslots[0].duration, url='fake-meetecho-url',
|
||||
deletion_token='please-delete-me',
|
||||
),
|
||||
|
@ -498,6 +498,7 @@ class InterimTests(TestCase):
|
|||
mock_conf_mgr.create.call_args[1],
|
||||
{
|
||||
'group': sessions[0].group,
|
||||
'session_id': sessions[0].id,
|
||||
'description': str(sessions[0]),
|
||||
'start_time': timeslots[0].utc_start_time(),
|
||||
'duration': timeslots[0].duration,
|
||||
|
@ -512,12 +513,12 @@ class InterimTests(TestCase):
|
|||
mock.reset_mock()
|
||||
mock_conf_mgr.create.side_effect = [
|
||||
[Conference(
|
||||
manager=mock_conf_mgr, id=1, public_id='some-uuid', description='desc',
|
||||
manager=mock_conf_mgr, id=int(sessions[0].pk), public_id='some-uuid', description='desc',
|
||||
start_time=timeslots[0].utc_start_time(), duration=timeslots[0].duration, url='different-fake-meetecho-url',
|
||||
deletion_token='please-delete-me',
|
||||
)],
|
||||
[Conference(
|
||||
manager=mock_conf_mgr, id=2, public_id='another-uuid', description='desc',
|
||||
manager=mock_conf_mgr, id=int(sessions[1].pk), public_id='another-uuid', description='desc',
|
||||
start_time=timeslots[1].utc_start_time(), duration=timeslots[1].duration, url='another-fake-meetecho-url',
|
||||
deletion_token='please-delete-me-too',
|
||||
)],
|
||||
|
@ -528,16 +529,18 @@ class InterimTests(TestCase):
|
|||
mock_conf_mgr.create.call_args_list,
|
||||
[
|
||||
({
|
||||
'group': sessions[0].group,
|
||||
'description': str(sessions[0]),
|
||||
'start_time': timeslots[0].utc_start_time(),
|
||||
'duration': timeslots[0].duration,
|
||||
'group': sessions[0].group,
|
||||
'session_id': sessions[0].id,
|
||||
'description': str(sessions[0]),
|
||||
'start_time': timeslots[0].utc_start_time(),
|
||||
'duration': timeslots[0].duration,
|
||||
},),
|
||||
({
|
||||
'group': sessions[1].group,
|
||||
'description': str(sessions[1]),
|
||||
'start_time': timeslots[1].utc_start_time(),
|
||||
'duration': timeslots[1].duration,
|
||||
'group': sessions[1].group,
|
||||
'session_id': sessions[1].id,
|
||||
'description': str(sessions[1]),
|
||||
'start_time': timeslots[1].utc_start_time(),
|
||||
'duration': timeslots[1].duration,
|
||||
},),
|
||||
]
|
||||
)
|
||||
|
|
|
@ -115,6 +115,7 @@ class MeetechoAPI:
|
|||
def schedule_meeting(
|
||||
self,
|
||||
wg_token: str,
|
||||
room_id: int,
|
||||
description: str,
|
||||
start_time: datetime.datetime,
|
||||
duration: datetime.timedelta,
|
||||
|
@ -139,6 +140,7 @@ class MeetechoAPI:
|
|||
}
|
||||
|
||||
:param wg_token: token retrieved via retrieve_wg_tokens()
|
||||
:param room_id: int id to identify the room (will be echoed as room.id)
|
||||
:param description: str describing the meeting
|
||||
:param start_time: starting time as a datetime
|
||||
:param duration: duration as a timedelta
|
||||
|
@ -151,6 +153,7 @@ class MeetechoAPI:
|
|||
"meeting/interim/createRoom",
|
||||
api_token=wg_token,
|
||||
json={
|
||||
"room_id": room_id,
|
||||
"description": description,
|
||||
"start_time": self._serialize_time(start_time),
|
||||
"duration": self._serialize_duration(duration),
|
||||
|
@ -455,9 +458,10 @@ class ConferenceManager(Manager):
|
|||
response = self.api.fetch_meetings(self.wg_token(group))
|
||||
return Conference.from_api_dict(self, response["rooms"])
|
||||
|
||||
def create(self, group, description, start_time, duration, extrainfo=""):
|
||||
def create(self, group, session_id, description, start_time, duration, extrainfo=""):
|
||||
response = self.api.schedule_meeting(
|
||||
wg_token=self.wg_token(group),
|
||||
room_id=int(session_id),
|
||||
description=description,
|
||||
start_time=start_time,
|
||||
duration=duration,
|
||||
|
|
|
@ -82,7 +82,7 @@ class APITests(TestCase):
|
|||
'rooms': {
|
||||
'3d55bce0-535e-4ba8-bb8e-734911cf3c32': {
|
||||
'room': {
|
||||
'id': 18,
|
||||
'id': 18, # should match room_id in api.schedule_meeting() below
|
||||
'start_time': '2021-09-14 10:00:00',
|
||||
'duration': 130,
|
||||
'description': 'interim-2021-wgname-01',
|
||||
|
@ -97,6 +97,7 @@ class APITests(TestCase):
|
|||
api = MeetechoAPI(API_BASE, CLIENT_ID, CLIENT_SECRET)
|
||||
api_response = api.schedule_meeting(
|
||||
wg_token='my-token',
|
||||
room_id=18,
|
||||
start_time=datetime.datetime(2021, 9, 14, 10, 0, 0, tzinfo=datetime.timezone.utc),
|
||||
duration=datetime.timedelta(minutes=130),
|
||||
description='interim-2021-wgname-01',
|
||||
|
@ -116,6 +117,7 @@ class APITests(TestCase):
|
|||
self.assertEqual(
|
||||
request.json(),
|
||||
{
|
||||
'room_id': 18,
|
||||
'duration': 130,
|
||||
'start_time': '2021-09-14 10:00:00',
|
||||
'extrainfo': 'message for staff',
|
||||
|
@ -485,7 +487,7 @@ class ConferenceManagerTests(TestCase):
|
|||
'rooms': {
|
||||
'session-1-uuid': {
|
||||
'room': {
|
||||
'id': 1,
|
||||
'id': 1, # value should match session_id param to cm.create() below
|
||||
'start_time': datetime.datetime(2022,2,4,1,2,3, tzinfo=datetime.timezone.utc),
|
||||
'duration': datetime.timedelta(minutes=45),
|
||||
'description': 'some-description',
|
||||
|
@ -496,7 +498,7 @@ class ConferenceManagerTests(TestCase):
|
|||
},
|
||||
}
|
||||
cm = ConferenceManager(settings.MEETECHO_API_CONFIG)
|
||||
result = cm.create('group', 'desc', 'starttime', 'dur', 'extra')
|
||||
result = cm.create('group', '1', 'desc', 'starttime', 'dur', 'extra')
|
||||
self.assertEqual(
|
||||
result,
|
||||
[Conference(
|
||||
|
@ -515,6 +517,7 @@ class ConferenceManagerTests(TestCase):
|
|||
kwargs,
|
||||
{
|
||||
'wg_token': 'atoken',
|
||||
'room_id': 1,
|
||||
'description': 'desc',
|
||||
'start_time': 'starttime',
|
||||
'duration': 'dur',
|
||||
|
|
Loading…
Reference in a new issue