How to use the canvasapi.progress.Progress function in canvasapi

To help you get started, we’ve selected a few canvasapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ucfopen / canvasapi / tests / test_progress.py View on Github external
def test_query(self, m):
        register_uris({'progress': ['progress_query']}, m)

        response = self.progress.query()
        self.assertIsInstance(response, Progress)
github ucfopen / canvasapi / tests / test_assignment.py View on Github external
def test_submissions_bulk_update(self, m):
        register_uris({"assignment": ["update_submissions"]}, m)
        register_uris({"progress": ["course_progress"]}, m)
        progress = self.assignment.submissions_bulk_update(
            grade_data={"1": {"posted_grade": 97}, "2": {"posted_grade": 98}}
        )
        self.assertIsInstance(progress, Progress)
        self.assertTrue(progress.context_type == "Course")
        progress = progress.query()
        self.assertTrue(progress.context_type == "Course")
github ucfopen / canvasapi / tests / test_course.py View on Github external
def test_submissions_bulk_update(self, m):
        register_uris({"course": ["update_submissions"]}, m)
        register_uris({"progress": ["course_progress"]}, m)
        progress = self.course.submissions_bulk_update(
            grade_data={"1": {"1": {"posted_grade": 97}, "2": {"posted_grade": 98}}}
        )
        self.assertIsInstance(progress, Progress)
        self.assertTrue(progress.context_type == "Course")
        progress = progress.query()
        self.assertTrue(progress.context_type == "Course")
github ucfopen / canvasapi / tests / test_canvas.py View on Github external
def test_conversations_batch_update(self, m):
        register_uris({"conversation": ["batch_update"]}, m)

        conversation_ids = [1, 2]
        this_event = "mark_as_read"
        result = self.canvas.conversations_batch_update(
            event=this_event, conversation_ids=conversation_ids
        )
        self.assertIsInstance(result, Progress)
github ucfopen / canvasapi / tests / test_group.py View on Github external
def test_assign_members(self, m):
        from canvasapi.progress import Progress
        from canvasapi.paginated_list import PaginatedList

        requires = {
            "group": ["category_assign_members_true", "category_assign_members_false"]
        }
        register_uris(requires, m)

        result_true = self.group_category.assign_members(sync=True)
        return_false = self.group_category.assign_members()

        self.assertIsInstance(result_true, PaginatedList)
        self.assertIsInstance(return_false, Progress)
github ucfopen / canvasapi / tests / test_canvas.py View on Github external
def test_get_progress(self, m):
        register_uris({"content_migration": ["get_progress"]}, m)

        progress = self.canvas.get_progress(1)
        self.assertIsInstance(progress, Progress)
        self.assertTrue(hasattr(progress, "id"))
        self.assertEqual(progress.id, 1)
github ucfopen / canvasapi / canvasapi / content_migration.py View on Github external
:calls: `GET /api/v1/progress/:id
            `_

        :rtype: :class:`canvasapi.progress.Progress`
        """

        from canvasapi.progress import Progress

        progress_id = self.progress_url.split("/")[-1]

        response = self._requester.request(
            'GET',
            'progress/{}'.format(progress_id),
            _kwargs=combine_kwargs(**kwargs)
        )
        return Progress(self._requester, response.json())
github ucfopen / canvasapi / canvasapi / sis_import.py View on Github external
def restore_states(self, **kwargs):
        """
        Restore workflow_states of SIS imported items.

        :calls: `PUT /api/v1/accounts/:account_id/sis_imports/:id/restore_states \
        `_

        :rtype: :class:`canvasapi.progress.Progress`
        """
        response = self._requester.request(
            'PUT',
            'accounts/{}/sis_imports/{}/restore_states'.format(self.account_id, self.id),
            _kwargs=combine_kwargs(**kwargs)
        )
        return Progress(self._requester, response.json())
github ucfopen / canvasapi / canvasapi / assignment.py View on Github external
submissions in an asynchronous job.

        :calls: `POST /api/v1/courses/:course_id/assignments/:assignment_id/ \
            submissions/update_grades \
        `_

        :rtype: :class:`canvasapi.progress.Progress`
        """
        response = self._requester.request(
            "POST",
            "courses/{}/assignments/{}/submissions/update_grades".format(
                self.course_id, self.id
            ),
            _kwargs=combine_kwargs(**kwargs),
        )
        return Progress(self._requester, response.json())
github ucfopen / canvasapi / canvasapi / canvas.py View on Github external
`_

        :param progress: The object or ID of the progress to retrieve.
        :type progress: int, str or :class:`canvasapi.progress.Progress`

        :rtype: :class:`canvasapi.progress.Progress`
        """

        from canvasapi.progress import Progress

        progress_id = obj_or_id(progress, "progress", (Progress,))

        response = self.__requester.request(
            "GET", "progress/{}".format(progress_id), _kwargs=combine_kwargs(**kwargs)
        )
        return Progress(self.__requester, response.json())