コード例 #1
0
    def test_user_joined_no_meeting(self):
        meetings_events = MeetingsEvents(
            server_url="localhost",
            external_meeting_id="mock_e",
            internal_meeting_id="mock_i",
            name="mock_n",
            create_time=0,
            create_date="Mock Date",
            voice_bridge="",
            dial_number="000-000-0000",
            attendee_pw="",
            moderator_pw="mp",
            duration=0,
            recording=False,
            max_users=0,
            is_breakout=False,
            meta_data={
                "mock_data": "mock",
                "another_mock": "mocked"
            },
        )

        self.handler.session.query().filter().first.side_effect = [
            meetings_events,
            None,
        ]

        with self.assertRaises(WebhookDatabaseError):
            self.handler.handle(self.event)
コード例 #2
0
    def test_user_joined_succeeds_transfer(self):
        meetings_events = MeetingsEvents(
            server_url="localhost",
            external_meeting_id="mock_e",
            internal_meeting_id="mock_i",
            name="mock_n",
            create_time=0,
            create_date="Mock Date",
            voice_bridge="",
            dial_number="000-000-0000",
            attendee_pw="",
            moderator_pw="mp",
            duration=0,
            recording=False,
            max_users=0,
            is_breakout=False,
            meta_data={
                "mock_data": "mock",
                "another_mock": "mocked"
            },
        )

        meetings = Meetings(
            running=False,
            transfer=True,
            transfer_count=0,
            has_user_joined=False,
            participant_count=0,
            listener_count=0,
            voice_participant_count=0,
            video_count=0,
            moderator_count=0,
            attendees=[],
        )

        self.handler.session.query().filter().first.side_effect = [
            meetings_events,
            meetings,
        ]
        self.handler.session.query().get.return_value = meetings

        self.handler.handle(self.transferEvent)
        self.handler.session.add.call_args_list

        self.assertEqual(self.handler.session.add.call_count, 3)
        self.assertEqual(meetings.transfer_count, 1)
        self.assertEqual(meetings.participant_count, 0)
        self.handler.session.flush.assert_called_once()
コード例 #3
0
    def test_meeting_ended_succeeds(self):
        meetings_events = MeetingsEvents(
            server_url="localhost",
            external_meeting_id="mock_e",
            internal_meeting_id="mock_i",
            name="mock_n",
            create_time=0,
            create_date="Mock Date",
            voice_bridge="",
            dial_number="000-000-0000",
            attendee_pw="",
            moderator_pw="mp",
            duration=0,
            recording=False,
            max_users=0,
            is_breakout=False,
            meta_data={
                "mock_data": "mock",
                "another_mock": "mocked"
            },
        )

        meetings = Meetings(
            running=False,
            has_user_joined=False,
            participant_count=0,
            listener_count=0,
            voice_participant_count=0,
            video_count=0,
            moderator_count=0,
            attendees=[],
        )

        self.handler.session.query().filter(
        ).first.return_value = meetings_events
        self.handler.session.query().get = mock.Mock(
            side_effect=[meetings_events, meetings])

        self.handler.handle(self.event)

        meetings_events = self.handler.session.get_first_add_arg
        meetings = self.handler.session.get_first_delete_arg()

        self.assertEqual(meetings_events.end_time, self.event.event.end_time)

        self.handler.session.add.assert_called_once_with(meetings_events)
        self.handler.session.delete.assert_called_once_with(meetings)