コード例 #1
0
    def test_repr_str(self):
        conference_solution = ConferenceSolution(
            entry_points=EntryPoint(EntryPoint.VIDEO),
            solution_type=SolutionType.HANGOUTS_MEET,
            name='Hangout',
            icon_uri='https://icon.com',
            conference_id='aaa-bbbb-ccc',
            signature='abc4efg12345',
            notes='important notes'
        )

        self.assertEqual(conference_solution.__repr__(),
                         "<ConferenceSolution hangoutsMeet - [<EntryPoint video - 'None'>]>")
        self.assertEqual(conference_solution.__str__(),
                         "hangoutsMeet - [<EntryPoint video - 'None'>]")

        conference_solution = ConferenceSolution(
            entry_points=[EntryPoint(EntryPoint.VIDEO), EntryPoint(EntryPoint.SIP)],
            solution_type=SolutionType.HANGOUTS_MEET,
            name='Hangout',
            icon_uri='https://icon.com',
            conference_id='aaa-bbbb-ccc',
            signature='abc4efg12345',
            notes='important notes'
        )

        self.assertEqual(conference_solution.__repr__(),
                         "<ConferenceSolution hangoutsMeet - [<EntryPoint video - 'None'>, <EntryPoint sip - 'None'>]>")
        self.assertEqual(conference_solution.__str__(),
                         "hangoutsMeet - [<EntryPoint video - 'None'>, <EntryPoint sip - 'None'>]")
コード例 #2
0
    def test_to_json(self):
        conference_solution = ConferenceSolution(
            entry_points=EntryPoint(EntryPoint.VIDEO, uri='https://video.com'),
            solution_type=SolutionType.HANGOUTS_MEET,
            name='Hangout',
            icon_uri='https://icon.com',
            conference_id='aaa-bbbb-ccc',
            signature='abc4efg12345',
            notes='important notes'
        )

        expected = {
            'entryPoints': [
                {
                    'entryPointType': 'video',
                    'uri': 'https://video.com',
                }
            ],
            'conferenceSolution': {
                'key': {
                    'type': 'hangoutsMeet'
                },
                'name': 'Hangout',
                'iconUri': 'https://icon.com'
            },
            'conferenceId': 'aaa-bbbb-ccc',
            'signature': 'abc4efg12345',
            'notes': 'important notes'
        }

        serializer = ConferenceSolutionSerializer(conference_solution)
        self.assertDictEqual(serializer.get_json(), expected)

        conference_solution = ConferenceSolution(
            entry_points=[
                EntryPoint(EntryPoint.VIDEO, uri='https://video.com'),
                EntryPoint(EntryPoint.PHONE, uri='+420000000000')
            ],
            solution_type=SolutionType.NAMED_HANGOUT,
        )

        expected = {
            'entryPoints': [
                {
                    'entryPointType': 'video',
                    'uri': 'https://video.com',
                },
                {
                    'entryPointType': 'phone',
                    'uri': '+420000000000',
                }
            ],
            'conferenceSolution': {
                'key': {
                    'type': 'eventNamedHangout'
                }
            }
        }

        self.assertDictEqual(ConferenceSolutionSerializer.to_json(conference_solution), expected)
コード例 #3
0
 def test_repr_str(self):
     entry_point = EntryPoint(
         EntryPoint.VIDEO,
         uri='https://video-conf.com/123123',
         label='label',
         pin='rU9xzGHz',
         access_code='sUhk4QPn',
         meeting_code='sUhk4QPn',
         passcode='YKa7m4D6',
         password='******'
     )
     self.assertEqual(entry_point.__repr__(), "<EntryPoint video - 'https://video-conf.com/123123'>")
     self.assertEqual(entry_point.__str__(), "video - 'https://video-conf.com/123123'")
コード例 #4
0
 def test_entry_point_types(self):
     with self.assertRaises(ValueError):
         ConferenceSolution(
             entry_points=[]
         )
     with self.assertRaises(ValueError):
         ConferenceSolution(
             entry_points=[
                 EntryPoint(EntryPoint.VIDEO),
                 EntryPoint(EntryPoint.VIDEO)
             ]
         )
     with self.assertRaises(ValueError):
         ConferenceSolution(
             entry_points=[
                 EntryPoint(EntryPoint.SIP),
                 EntryPoint(EntryPoint.SIP)
             ]
         )
     with self.assertRaises(ValueError):
         ConferenceSolution(
             entry_points=[
                 EntryPoint(EntryPoint.SIP),
                 EntryPoint(EntryPoint.MORE),
                 EntryPoint(EntryPoint.MORE)
             ]
         )
     with self.assertRaises(ValueError):
         # can't have only MORE entry point(s)
         ConferenceSolution(
             entry_points=[
                 EntryPoint(EntryPoint.MORE)
             ]
         )
コード例 #5
0
    def test_init(self):
        conference_solution = ConferenceSolution(
            entry_points=EntryPoint(EntryPoint.VIDEO),
            solution_type=SolutionType.HANGOUTS_MEET,
            name='Hangout',
            icon_uri='https://icon.com',
            conference_id='aaa-bbbb-ccc',
            signature='abc4efg12345',
            notes='important notes'
        )

        self.assertListEqual(conference_solution.entry_points, [EntryPoint(EntryPoint.VIDEO)])
        self.assertEqual(conference_solution.solution_type, SolutionType.HANGOUTS_MEET)
        self.assertEqual(conference_solution.name, 'Hangout')
        self.assertEqual(conference_solution.icon_uri, 'https://icon.com')
        self.assertEqual(conference_solution.conference_id, 'aaa-bbbb-ccc')
        self.assertEqual(conference_solution.signature, 'abc4efg12345')
        self.assertEqual(conference_solution.notes, 'important notes')

        conference_solution = ConferenceSolution(
            entry_points=[EntryPoint(EntryPoint.VIDEO)],
        )
        self.assertEqual(conference_solution.entry_points, [EntryPoint(EntryPoint.VIDEO)])

        conference_solution = ConferenceSolution(
            entry_points=[EntryPoint(EntryPoint.VIDEO),
                          EntryPoint(EntryPoint.PHONE)],
        )
        self.assertEqual(conference_solution.entry_points, [EntryPoint(EntryPoint.VIDEO),
                                                            EntryPoint(EntryPoint.PHONE)])
コード例 #6
0
 def _to_object(json_):
     return EntryPoint(entry_point_type=json_.get('entryPointType'),
                       uri=json_.get('uri'),
                       label=json_.get('label'),
                       pin=json_.get('pin'),
                       access_code=json_.get('accessCode'),
                       meeting_code=json_.get('meetingCode'),
                       passcode=json_.get('passcode'),
                       password=json_.get('password'))
コード例 #7
0
    def test_to_json(self):
        entry_point = EntryPoint(
            EntryPoint.SIP,
            uri='sip:123123',
            label='label',
            pin='rU9xzGHz',
            access_code='sUhk4QPn',
            meeting_code='sUhk4QPn',
            passcode='YKa7m4D6',
            password='******'
        )
        expected = {
            'entryPointType': 'sip',
            'uri': 'sip:123123',
            'label': 'label',
            'pin': 'rU9xzGHz',
            'accessCode': 'sUhk4QPn',
            'meetingCode': 'sUhk4QPn',
            'passcode': 'YKa7m4D6',
            'password': '******'
        }

        serializer = EntryPointSerializer(entry_point)
        self.assertDictEqual(serializer.get_json(), expected)

        entry_point = EntryPoint(
            EntryPoint.MORE,
            uri='https://less.com',
            pin='rU9xzGHz',
            meeting_code='sUhk4QPn',
            password='******'
        )

        expected = {
            'entryPointType': 'more',
            'uri': 'https://less.com',
            'pin': 'rU9xzGHz',
            'meetingCode': 'sUhk4QPn',
            'password': '******'
        }

        self.assertDictEqual(EntryPointSerializer.to_json(entry_point), expected)
コード例 #8
0
 def test_eq(self):
     conference_solution = ConferenceSolution(
         entry_points=EntryPoint(EntryPoint.VIDEO, uri='https://video.com'),
         solution_type=SolutionType.HANGOUTS_MEET,
         name='Hangout',
         icon_uri='https://icon.com',
         conference_id='aaa-bbbb-ccc',
         signature='abc4efg12345',
         notes='important notes'
     )
     self.assertFalse(conference_solution == 5)
コード例 #9
0
 def test_to_json_conference_solution(self):
     e = Event('Good day',
               start=(1 / Jul / 2020)[11:22:33],
               timezone=TEST_TIMEZONE,
               conference_solution=ConferenceSolution(
                   entry_points=EntryPoint(EntryPoint.VIDEO,
                                           uri='https://video.com'),
                   solution_type=SolutionType.HANGOUTS_MEET,
                   name='Hangout',
                   icon_uri='https://icon.com',
                   conference_id='aaa-bbbb-ccc',
                   signature='abc4efg12345',
                   notes='important notes'))
     expected_event_json = {
         'summary': 'Good day',
         'start': {
             'dateTime': '2020-07-01T11:22:33+12:00',
             'timeZone': TEST_TIMEZONE
         },
         'end': {
             'dateTime': '2020-07-01T12:22:33+12:00',
             'timeZone': TEST_TIMEZONE
         },
         'recurrence': [],
         'visibility': 'default',
         'attendees': [],
         'reminders': {
             'useDefault': False
         },
         'attachments': [],
         'conferenceData': {
             'entryPoints': [{
                 'entryPointType': 'video',
                 'uri': 'https://video.com',
             }],
             'conferenceSolution': {
                 'key': {
                     'type': 'hangoutsMeet'
                 },
                 'name': 'Hangout',
                 'iconUri': 'https://icon.com'
             },
             'conferenceId':
             'aaa-bbbb-ccc',
             'signature':
             'abc4efg12345',
             'notes':
             'important notes'
         },
         'guestsCanInviteOthers': True,
         'guestsCanModify': False,
         'guestsCanSeeOtherGuests': True,
     }
     self.assertDictEqual(EventSerializer.to_json(e), expected_event_json)
コード例 #10
0
 def test_eq(self):
     entry_point = EntryPoint(
         EntryPoint.VIDEO,
         uri='https://video-conf.com/123123',
         label='label',
         pin='rU9xzGHz',
         access_code='sUhk4QPn',
         meeting_code='sUhk4QPn',
         passcode='YKa7m4D6',
         password='******'
     )
     self.assertFalse(entry_point == 5)
     self.assertTrue(entry_point == entry_point)
コード例 #11
0
 def test_checks(self):
     with self.assertRaises(ValueError):
         EntryPoint('Offline')
     with self.assertRaises(ValueError):
         EntryPoint(EntryPoint.PHONE, label='a' * 513)
     with self.assertRaises(ValueError):
         EntryPoint(EntryPoint.PHONE, pin='a' * 129)
     with self.assertRaises(ValueError):
         EntryPoint(EntryPoint.PHONE, access_code='a' * 129)
     with self.assertRaises(ValueError):
         EntryPoint(EntryPoint.PHONE, meeting_code='a' * 129)
     with self.assertRaises(ValueError):
         EntryPoint(EntryPoint.PHONE, passcode='a' * 129)
     with self.assertRaises(ValueError):
         EntryPoint(EntryPoint.PHONE, password='******' * 129)
コード例 #12
0
    def test_init(self):
        entry_point = EntryPoint(
            EntryPoint.VIDEO,
            uri='https://video-conf.com/123123',
            label='label',
            pin='rU9xzGHz',
            access_code='sUhk4QPn',
            meeting_code='sUhk4QPn',
            passcode='YKa7m4D6',
            password='******'
        )

        self.assertEqual(entry_point.entry_point_type, EntryPoint.VIDEO)
        self.assertEqual(entry_point.uri, 'https://video-conf.com/123123')
        self.assertEqual(entry_point.label, 'label')
        self.assertEqual(entry_point.pin, 'rU9xzGHz')
        self.assertEqual(entry_point.access_code, 'sUhk4QPn')
        self.assertEqual(entry_point.meeting_code, 'sUhk4QPn')
        self.assertEqual(entry_point.passcode, 'YKa7m4D6')
        self.assertEqual(entry_point.password, 'JW7t7f35')