Beispiel #1
0
 def get_account_report(self, **kwargs):
     util.require_keys(kwargs, ['start_time', 'end_time'])
     kwargs['from'] = util.date_to_str(kwargs['start_time'])
     del kwargs['start_time']
     kwargs['to'] = util.date_to_str(kwargs['end_time'])
     del kwargs['end_time']
     return self.get_request("/report/users", params=kwargs)
Beispiel #2
0
 def get_user_report(self, **kwargs):
     util.require_keys(kwargs, ["start_time", "end_time"], kwargs)
     kwargs["from"] = util.date_to_str(kwargs["start_time"])
     del kwargs["start_time"]
     kwargs["to"] = util.date_to_str(kwargs["end_time"])
     del kwargs["end_time"]
     return self.post_request("/report/getuserreport", params=kwargs)
Beispiel #3
0
 def get_account_report(self, **kwargs):
     util.require_keys(kwargs, ["start_time", "end_time"])
     kwargs["from"] = util.date_to_str(kwargs["start_time"])
     del kwargs["start_time"]
     kwargs["to"] = util.date_to_str(kwargs["end_time"])
     del kwargs["end_time"]
     return self.get_request("/report/users", params=kwargs)
Beispiel #4
0
 def get_user_report(self, **kwargs):
     util.require_keys(kwargs, ['start_time', 'end_time'], kwargs)
     kwargs['from'] = util.date_to_str(kwargs['start_time'])
     del kwargs['start_time']
     kwargs['to'] = util.date_to_str(kwargs['end_time'])
     del kwargs['end_time']
     return self.post_request("/report/getuserreport", params=kwargs)
Beispiel #5
0
 def list(self, **kwargs):
     util.require_keys(kwargs, 'host_id')
     start = kwargs.pop('start', None)
     if start:
         kwargs['from'] = util.date_to_str(start)
     end = kwargs.pop('end', None)
     if end:
         kwargs['to'] = util.date_to_str(end)
     return self.post_request("/recording/list", params=kwargs)
Beispiel #6
0
 def list(self, **kwargs):
     util.require_keys(kwargs, "host_id")
     start = kwargs.pop("start", None)
     if start:
         kwargs["from"] = util.date_to_str(start)
     end = kwargs.pop("end", None)
     if end:
         kwargs["to"] = util.date_to_str(end)
     return self.post_request("/recording/list", params=kwargs)
Beispiel #7
0
 def get_user_report(self, **kwargs):
     util.require_keys(kwargs, ["user_id", "start_time", "end_time"])
     kwargs["from"] = util.date_to_str(kwargs["start_time"])
     del kwargs["start_time"]
     kwargs["to"] = util.date_to_str(kwargs["end_time"])
     del kwargs["end_time"]
     return self.get_request(
         "/report/users/{}/meetings".format(kwargs.get("user_id")), params=kwargs
     )
Beispiel #8
0
 def get_user_report(self, **kwargs):
     util.require_keys(kwargs, ['user_id', 'start_time', 'end_time'])
     kwargs['from'] = util.date_to_str(kwargs['start_time'])
     del kwargs['start_time']
     kwargs['to'] = util.date_to_str(kwargs['end_time'])
     del kwargs['end_time']
     return self.get_request("/report/users/{}/meetings".format(
         kwargs.get('user_id')),
                             params=kwargs)
Beispiel #9
0
 def get_user_report(self, **kwargs):
     util.require_keys(kwargs, ['start_time', 'end_time'], kwargs)
     if kwargs.get('start_time'):
         kwargs['from'] = util.date_to_str(kwargs['start_time'])
         del kwargs['start_time']
     if kwargs.get('end_time'):
         kwargs['to'] = util.date_to_str(kwargs['end_time'])
         del kwargs['end_time']
     return self.post_request("/report/getuserreport", params=kwargs)
Beispiel #10
0
 def list(self, **kwargs):
     util.require_keys(kwargs, 'host_id')
     start = kwargs.pop('start', None)
     if start:
         kwargs['from'] = util.date_to_str(start)
     end = kwargs.pop('end', None)
     if end:
         kwargs['to'] = util.date_to_str(end)
     return self.post_request("/recording/list", params=kwargs)
Beispiel #11
0
 def get_account_report(self, **kwargs):
     util.require_keys(kwargs, ['start_time', 'end_time'], kwargs)
     if kwargs.get('start_time'):
         kwargs['from'] = util.date_to_str(kwargs['start_time'])
         del kwargs['start_time']
     if kwargs.get('end_time'):
         kwargs['to'] = util.date_to_str(kwargs['end_time'])
         del kwargs['end_time']
     return self.post_request("/report/getaccountreport", params=kwargs)
Beispiel #12
0
 def list(self, **kwargs):
     util.require_keys(kwargs, "user_id")
     start = kwargs.pop("start", None)
     if start:
         kwargs["from"] = util.date_to_str(start)
     end = kwargs.pop("end", None)
     if end:
         kwargs["to"] = util.date_to_str(end)
     return self.get_request("/users/{}/recordings".format(
         kwargs.get("user_id")),
                             params=kwargs)
Beispiel #13
0
 def list(self, **kwargs):
     util.require_keys(kwargs, 'user_id')
     start = kwargs.pop('start', None)
     if start:
         kwargs['from'] = util.date_to_str(start)
     end = kwargs.pop('end', None)
     if end:
         kwargs['to'] = util.date_to_str(end)
     return self.get_request("/users/{}/recordings".format(
         kwargs.get('user_id')),
                             params=kwargs)
Beispiel #14
0
    def test_can_get_account_report(self, mock_get_request):
        start_time = datetime.datetime.utcnow()
        end_time = datetime.datetime.utcnow()
        self.component.get_account_report(start_time=start_time, end_time=end_time)

        mock_get_request.assert_called_with(
            "/report/users",
            params={
                "from": util.date_to_str(start_time),
                "to": util.date_to_str(end_time),
            },
        )
Beispiel #15
0
    def test_can_get_user_report(self, mock_get_request):
        start_time = datetime.datetime.utcnow()
        end_time = datetime.datetime.utcnow()
        self.component.get_user_report(user_id="ID",
                                       start_time=start_time,
                                       end_time=end_time)

        mock_get_request.assert_called_with(
            "/report/users/ID/meetings",
            params={
                "user_id": "ID",
                "from": util.date_to_str(start_time),
                "to": util.date_to_str(end_time),
            },
        )
Beispiel #16
0
    def test_does_convert_start_time_to_str_if_datetime(
            self, mock_get_request):
        start_time = datetime.datetime.utcnow()
        end_time = datetime.datetime.utcnow()

        self.component.get_account_report(start_time=start_time,
                                          end_time=end_time)

        mock_get_request.assert_called_with("/report/users",
                                            params={
                                                'from':
                                                util.date_to_str(start_time),
                                                'to':
                                                util.date_to_str(end_time)
                                            })
Beispiel #17
0
    def test_can_get_user_report(self, mock_get_request):
        start_time = datetime.datetime.utcnow()
        end_time = datetime.datetime.utcnow()
        self.component.get_user_report(user_id='ID',
                                       start_time=start_time,
                                       end_time=end_time)

        mock_get_request.assert_called_with("/report/users/ID/meetings",
                                            params={
                                                'user_id':
                                                'ID',
                                                'from':
                                                util.date_to_str(start_time),
                                                'to':
                                                util.date_to_str(end_time)
                                            })
Beispiel #18
0
 def update(self, **kwargs):
     util.require_keys(kwargs, "id")
     if kwargs.get("start_time"):
         kwargs["start_time"] = util.date_to_str(kwargs["start_time"])
     return self.patch_request(
         "/meetings/{}".format(kwargs.get("id")), params=kwargs
     )
Beispiel #19
0
    def test_can_get_user_report(self):
        with patch.object(components.base.BaseComponent,
                          'post_request',
                          return_value=True) as mock_post_request:

            start_time = datetime.datetime.utcnow()
            end_time = datetime.datetime.utcnow()
            self.component.get_user_report(start_time=start_time,
                                           end_time=end_time)

            mock_post_request.assert_called_with(
                "/report/getuserreport",
                params={
                    'from': util.date_to_str(start_time),
                    'to': util.date_to_str(end_time)
                })
Beispiel #20
0
 def create(self, **kwargs):
     util.require_keys(kwargs, "user_id")
     if kwargs.get("start_time"):
         kwargs["start_time"] = util.date_to_str(kwargs["start_time"])
     return self.post_request("/users/{}/meetings".format(
         kwargs.get("user_id")),
                              data=kwargs)
Beispiel #21
0
 def update(self, **kwargs):
     util.require_keys(kwargs, 'id')
     if kwargs.get('start_time'):
         kwargs['start_time'] = util.date_to_str(kwargs['start_time'])
     return self.patch_request(
         "/meetings/{}".format(kwargs.get('id')),
         params=kwargs)
Beispiel #22
0
 def create(self, **kwargs):
     util.require_keys(kwargs, 'user_id')
     if kwargs.get('start_time'):
         kwargs['start_time'] = util.date_to_str(kwargs['start_time'])
     return self.post_request(
         "/users/{}/meetings".format(kwargs.get('user_id')),
         params=kwargs, data=kwargs.get('data'))
Beispiel #23
0
    def test_can_get_account_report(self):
        with patch.object(
            components.base.BaseComponent, "post_request", return_value=True
        ) as mock_post_request:

            start_time = datetime.datetime.utcnow()
            end_time = datetime.datetime.utcnow()
            self.component.get_account_report(start_time=start_time, end_time=end_time)

            mock_post_request.assert_called_with(
                "/report/getaccountreport",
                params={
                    "from": util.date_to_str(start_time),
                    "to": util.date_to_str(end_time),
                },
            )
Beispiel #24
0
    def test_can_get_account_report(self):
        with patch.object(components.base.BaseComponent, 'post_request',
                          return_value=True) as mock_post_request:

            start_time = datetime.datetime.utcnow()
            end_time = datetime.datetime.utcnow()
            self.component.get_account_report(
                start_time=start_time, end_time=end_time)

            mock_post_request.assert_called_with(
                "/report/getaccountreport",
                params={
                    'from': util.date_to_str(start_time),
                    'to': util.date_to_str(end_time)
                }
            )
Beispiel #25
0
    def test_does_convert_startime_to_str_if_datetime(self, mock_get_request):
        start_time = datetime.datetime.utcnow() - datetime.timedelta(days=10)
        end_time = datetime.datetime.utcnow()
        self.component.list(user_id="ID",
                            start=start_time,
                            end=end_time,
                            meeting_number="111")

        mock_get_request.assert_called_with(
            "/users/ID/recordings",
            params={
                "user_id": "ID",
                "from": util.date_to_str(start_time),
                "to": util.date_to_str(end_time),
                "meeting_number": "111",
            },
        )
Beispiel #26
0
    def test_does_convert_startime_to_str_if_datetime(self, mock_post_request):
        start_time = datetime.datetime.utcnow()
        self.component.create(user_id="ID", start_time=start_time)

        mock_post_request.assert_called_with(
            "/users/ID/meetings",
            params={"user_id": "ID", "start_time": util.date_to_str(start_time)},
        )
Beispiel #27
0
 def test_can_convert_datetime_to_str(self):
     d = datetime.datetime(year=2015,
                           month=12,
                           day=8,
                           hour=23,
                           minute=21,
                           second=37)
     self.assertEqual(util.date_to_str(d), "2015-12-08T23:21:37Z")
Beispiel #28
0
 def create(self, **kwargs):
     util.require_keys(kwargs, ["user_id", "data"])
     if kwargs.get("start_time"):
         kwargs["start_time"] = util.date_to_str(kwargs["start_time"])
     data = kwargs.pop('data')
     return self.post_request("/users/{}/meetings".format(
         kwargs.get("user_id")),
                              params=kwargs,
                              data=data)
Beispiel #29
0
    def create(self, **kwargs):
        util.require_keys(kwargs, "user_id")
        if kwargs.get("start_time") and not isinstance(kwargs['start_time'],
                                                       str):
            kwargs["start_time"] = util.date_to_str(kwargs["start_time"])

        return self.post_request("/users/{}/meetings".format(
            kwargs.get("user_id")),
                                 params=kwargs)
Beispiel #30
0
    def test_can_get_user_report(self):
        with patch.object(components.base.BaseComponent, "post_request", return_value=True) as mock_post_request:

            start_time = datetime.datetime.utcnow()
            end_time = datetime.datetime.utcnow()
            self.component.get_user_report(start_time=start_time, end_time=end_time)

            mock_post_request.assert_called_with(
                "/report/getuserreport", params={"from": util.date_to_str(start_time), "to": util.date_to_str(end_time)}
            )
Beispiel #31
0
    def test_does_convert_startime_to_str_if_datetime(self):

        with patch.object(components.base.BaseComponent, "post_request", return_value=True) as mock_post_request:

            start_time = datetime.datetime.utcnow()
            self.component.create(host_id="ID", topic="TOPIC", start_time=start_time)

            mock_post_request.assert_called_with(
                "/webinar/create",
                params={"host_id": "ID", "topic": "TOPIC", "start_time": util.date_to_str(start_time)},
            )
    def test_does_convert_startime_to_str_if_datetime(self):

        with patch.object(components.base.BaseComponent,
                          'post_request',
                          return_value=True) as mock_post_request:

            start_time = datetime.datetime.utcnow() - datetime.timedelta(
                days=10)
            end_time = datetime.datetime.utcnow()
            self.component.list(host_id='ID',
                                start=start_time,
                                end=end_time,
                                meeting_number="111")

            mock_post_request.assert_called_with(
                "/recording/list",
                params={
                    'host_id': 'ID',
                    'from': util.date_to_str(start_time),
                    'to': util.date_to_str(end_time),
                    "meeting_number": "111"
                })
Beispiel #33
0
    def test_does_convert_startime_to_str_if_datetime(self):

        with patch.object(components.base.BaseComponent, 'post_request',
                          return_value=True) as mock_post_request:

            start_time = datetime.datetime.utcnow() - datetime.timedelta(days=10)
            end_time = datetime.datetime.utcnow()
            self.component.list(
                host_id='ID',
                start=start_time,
                end=end_time,
                meeting_number="111")

            mock_post_request.assert_called_with(
                "/recording/list",
                params={
                    'host_id': 'ID',
                    'from': util.date_to_str(start_time),
                    'to': util.date_to_str(end_time),
                    "meeting_number": "111"
                }
            )
Beispiel #34
0
    def test_does_convert_startime_to_str_if_datetime(self, mock_post_request):
        start_time = datetime.datetime.utcnow()
        self.component.create(host_id="ID",
                              topic="TOPIC",
                              start_time=start_time)

        mock_post_request.assert_called_with(
            "/webinar/create",
            params={
                "host_id": "ID",
                "topic": "TOPIC",
                "start_time": util.date_to_str(start_time),
            },
        )
Beispiel #35
0
    def test_does_convert_startime_to_str_if_datetime(self, mock_post_request):
        start_time = datetime.datetime.utcnow()
        self.component.create(host_id='ID',
                              topic='TOPIC',
                              start_time=start_time)

        mock_post_request.assert_called_with("/webinar/create",
                                             params={
                                                 'host_id':
                                                 'ID',
                                                 'topic':
                                                 'TOPIC',
                                                 'start_time':
                                                 util.date_to_str(start_time)
                                             })
Beispiel #36
0
    def test_does_convert_startime_to_str_if_datetime(self):

        with patch.object(components.base.BaseComponent,
                          'post_request',
                          return_value=True) as mock_post_request:

            start_time = datetime.datetime.utcnow()
            self.component.create(host_id='ID',
                                  topic='TOPIC',
                                  start_time=start_time)

            mock_post_request.assert_called_with(
                "/webinar/create",
                params={
                    'host_id': 'ID',
                    'topic': 'TOPIC',
                    'start_time': util.date_to_str(start_time)
                })
Beispiel #37
0
    def test_does_convert_startime_to_str_if_datetime(self):

        with patch.object(components.base.BaseComponent, 'post_request',
                          return_value=True) as mock_post_request:

            start_time = datetime.datetime.utcnow()
            self.component.list(
                host_id='ID', topic='TOPIC', type='TYPE',
                start_time=start_time)

            mock_post_request.assert_called_with(
                "/meeting/list",
                params={
                    'host_id': 'ID',
                    'topic': 'TOPIC',
                    'type': 'TYPE',
                    'start_time': util.date_to_str(start_time)
                }
            )
Beispiel #38
0
 def test_can_convert_date_to_str(self):
     d = datetime.date(year=2015, month=12, day=8)
     self.assertEqual(
         util.date_to_str(d),
         "2015-12-08T00:00:00Z")
Beispiel #39
0
 def register(self, **kwargs):
     util.require_keys(kwargs, ['id', 'email', 'first_name', 'last_name'])
     if kwargs.get('start_time'):
         kwargs['start_time'] = util.date_to_str(kwargs['start_time'])
     return self.post_request("/webinar/register", params=kwargs)
Beispiel #40
0
 def update(self, **kwargs):
     util.require_keys(kwargs, ['id', 'host_id'])
     if kwargs.get('start_time'):
         kwargs['start_time'] = util.date_to_str(kwargs['start_time'])
     return self.post_request("/webinar/update", params=kwargs)
Beispiel #41
0
 def create(self, **kwargs):
     util.require_keys(kwargs, ['host_id', 'topic', 'type'])
     if kwargs.get('start_time'):
         kwargs['start_time'] = util.date_to_str(kwargs['start_time'])
     return self.post_request("/meeting/create", params=kwargs)
Beispiel #42
0
 def list(self, **kwargs):
     util.require_keys(kwargs, 'host_id')
     if kwargs.get('start_time'):
         kwargs['start_time'] = util.date_to_str(kwargs['start_time'])
     return self.post_request("/meeting/list", params=kwargs)
Beispiel #43
0
 def test_can_convert_datetime_to_str(self):
     d = datetime.datetime(
         year=2015, month=12, day=8, hour=23, minute=21, second=37)
     self.assertEqual(
         util.date_to_str(d),
         "2015-12-08T23:21:37Z")