Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_export_content(self, m):
register_uris({"group": ["export_content"]}, m)
content_export = self.group.export_content("d")
self.assertIsInstance(content_export, ContentExport)
self.assertTrue(hasattr(content_export, "export_type"))
def test_list_content_exports(self, m):
register_uris({"course": ["multiple_content_exports"]}, m)
content_exports = self.course.get_content_exports()
content_export_list = [content_export for content_export in content_exports]
self.assertEqual(len(content_export_list), 2)
self.assertEqual(content_export_list[0].id, 2)
self.assertEqual(content_export_list[1].export_type, "b")
self.assertIsInstance(content_export_list[0], ContentExport)
def test_export_content(self, m):
register_uris({"course": ["export_content"]}, m)
content_export = self.course.export_content("d")
self.assertIsInstance(content_export, ContentExport)
self.assertTrue(hasattr(content_export, "export_type"))
def test_list_content_exports(self, m):
register_uris({"user": ["multiple_content_exports"]}, m)
content_exports = self.user.get_content_exports()
content_export_list = [content_export for content_export in content_exports]
self.assertEqual(len(content_export_list), 2)
self.assertEqual(content_export_list[0].id, 2)
self.assertEqual(content_export_list[1].export_type, "b")
self.assertIsInstance(content_export_list[0], ContentExport)
:param content_export: The object or ID of the content export to show.
:type content_export: int or :class:`canvasapi.content_export.ContentExport`
:rtype: :class:`canvasapi.content_export.ContentExport`
"""
from canvasapi.content_export import ContentExport
export_id = obj_or_id(content_export, "content_export", (ContentExport,))
response = self._requester.request(
"GET",
"users/{}/content_exports/{}".format(self.id, export_id),
_kwargs=combine_kwargs(**kwargs),
)
return ContentExport(self._requester, response.json())
:param export_type: The type of content to export.
:type export_type: str
:rtype: :class:`canvasapi.content_export.ContentExport`
"""
from canvasapi.content_export import ContentExport
kwargs["export_type"] = export_type
response = self._requester.request(
"POST",
"users/{}/content_exports".format(self.id),
_kwargs=combine_kwargs(**kwargs),
)
return ContentExport(self._requester, response.json())
:param content_export: The object or ID of the content export to show.
:type content_export: int or :class:`canvasapi.content_export.ContentExport`
:rtype: :class:`canvasapi.content_export.ContentExport`
"""
from canvasapi.content_export import ContentExport
export_id = obj_or_id(content_export, "content_export", (ContentExport,))
response = self._requester.request(
"GET",
"courses/{}/content_exports/{}".format(self.id, export_id),
_kwargs=combine_kwargs(**kwargs),
)
return ContentExport(self._requester, response.json())
:param export_type: The type of content to export.
:type export_type: str
:rtype: :class:`canvasapi.content_export.ContentExport`
"""
from canvasapi.content_export import ContentExport
kwargs["export_type"] = export_type
response = self._requester.request(
"POST",
"groups/{}/content_exports".format(self.id),
_kwargs=combine_kwargs(**kwargs),
)
return ContentExport(self._requester, response.json())
:param export_type: The type of content to export.
:type export_type: str
:rtype: :class:`canvasapi.content_export.ContentExport`
"""
from canvasapi.content_export import ContentExport
kwargs["export_type"] = export_type
response = self._requester.request(
"POST",
"courses/{}/content_exports".format(self.id),
_kwargs=combine_kwargs(**kwargs),
)
return ContentExport(self._requester, response.json())