Ejemplo n.º 1
0
    def test_calendars_delete_event(self):

        calendar_id = "cal_n23kjnwrw2_sakdnawerd3"

        responses.add(responses.DELETE, 'https://api.cronofy.com/v1/calendars/{}/events'.format(calendar_id),
                      body=json.dumps(DUMMY_EVENT_DELETE), status=202,
                      content_type='application/json')

        params = {"blah": "blah"}

        try:
            Calendar.delete_event(object_id=calendar_id, access_token="DUMMY", params=params)
        except cronofy.CronofyError as e:
            self.fail("request raised exception: {}".format(e))
Ejemplo n.º 2
0
    def test_calendars_all(self):
        responses.add(responses.GET, 'https://api.cronofy.com/v1/calendars',
                      body=json.dumps(DUMMY_CALENDARS), status=200,
                      content_type='application/json')

        calendars = Calendar.all(access_token="DUMMY", params=None)

        self.assertEqual(3, len(calendars))
Ejemplo n.º 3
0
    def test_calendars_delete_event(self):

        calendar_id = "cal_n23kjnwrw2_sakdnawerd3"

        responses.add(responses.DELETE,
                      'https://api.cronofy.com/v1/calendars/{}/events'.format(
                          calendar_id),
                      body=json.dumps(DUMMY_EVENT_DELETE),
                      status=202,
                      content_type='application/json')

        params = {"blah": "blah"}

        try:
            Calendar.delete_event(object_id=calendar_id,
                                  access_token="DUMMY",
                                  params=params)
        except cronofy.CronofyError as e:
            self.fail("request raised exception: {}".format(e))
Ejemplo n.º 4
0
    def test_calendars_all(self):
        responses.add(responses.GET,
                      'https://api.cronofy.com/v1/calendars',
                      body=json.dumps(DUMMY_CALENDARS),
                      status=200,
                      content_type='application/json')

        calendars = Calendar.all(access_token="DUMMY", params=None)

        self.assertEqual(3, len(calendars))
Ejemplo n.º 5
0
    def test_calendars_create(self):
        responses.add(responses.POST, 'https://api.cronofy.com/v1/calendars',
                      body=json.dumps(DUMMY_CREATED_CALENDAR), status=200,
                      content_type='application/json')

        params = {"profile_id": "pro_n23kjnwrw2", "name": "New Calendar"}

        calendar = Calendar.create(access_token="DUMMY",
                                    params=params)

        self.assertEqual(calendar.calendar_name, params['name'])
        self.assertEqual(calendar.profile_id, params['profile_id'])
Ejemplo n.º 6
0
    def test_calendars_create(self):
        responses.add(responses.POST,
                      'https://api.cronofy.com/v1/calendars',
                      body=json.dumps(DUMMY_CREATED_CALENDAR),
                      status=200,
                      content_type='application/json')

        params = {"profile_id": "pro_n23kjnwrw2", "name": "New Calendar"}

        calendar = Calendar.create(access_token="DUMMY", params=params)

        self.assertEqual(calendar.calendar_name, params['name'])
        self.assertEqual(calendar.profile_id, params['profile_id'])