From 39bb759f680ba497222613993207af66b15de499 Mon Sep 17 00:00:00 2001 From: Allison Beemer <66966224+anbeemer@users.noreply.github.com> Date: Tue, 23 Jul 2024 21:07:38 -0500 Subject: [PATCH 1/5] Added info on meta.json file in uploading_files doc --- docs/tutorials/uploading_files.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/tutorials/uploading_files.rst b/docs/tutorials/uploading_files.rst index 4a97c26..93169b0 100644 --- a/docs/tutorials/uploading_files.rst +++ b/docs/tutorials/uploading_files.rst @@ -1,12 +1,13 @@ How to upload a file -------------------------------------------------------------------------- - +When uploading a file `FILE.XXX`, a `meta.json` file should be created in a folder named `FILE.file`, +specifying where the file is sent on Canvas. The `meta.json` file ==================== -Filenames and titles of files are distinct on canvas: +Filenames and titles of files are distinct on Canvas: the latter is what you will see when the file is placed in a module, while the former is what is shown in the file structure. You can place a file in as many modules as you wish by specifying the modules in the `meta.json` file. @@ -16,7 +17,7 @@ If no module with the specified name exists, a module will be created to house t The `destination` key specifies where in the file structure you would like the file to be placed. Note that while a file cannot be simultaneously placed in multiple file structure locations using `meta.json`, if `meta.json` is updated, -the file will not automatically be deleted from any previous location unless that instance is specifically deleted. +the file will **not** automatically be deleted from any previous location unless that instance is specifically deleted. Example @@ -34,7 +35,7 @@ If the `meta.json` file looks like: "destination": "course_info/syllabus_schedule" } -then the file `F24_Math100_syllabus.pdf` will be put into two modules: `Course Information` and `Week 1`. +then the file in question will be named `F24_Math100_syllabus.pdf` and put into two modules: `Course Information` and `Week 1`. Within these two modules, its title will appear to students as `Syllabus`. The file will be located in `course_info/syllabus_schedule`, which will be created if it did not already exist. From 7eb01847351788d9695895907ab44160cde3f754 Mon Sep 17 00:00:00 2001 From: Allison Beemer <66966224+anbeemer@users.noreply.github.com> Date: Tue, 23 Jul 2024 21:33:09 -0500 Subject: [PATCH 2/5] Namespace updates to unit tests due to refactor --- test/test_assignment.py | 10 +++++----- test/test_droplets.py | 8 ++++---- test/test_image.py | 10 +++++----- test/test_link_to_local_file.py | 8 ++++---- test/test_page_in_module.py | 16 ++++++++-------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/test/test_assignment.py b/test/test_assignment.py index 5b616b3..85dde44 100644 --- a/test/test_assignment.py +++ b/test/test_assignment.py @@ -46,12 +46,12 @@ def test_can_publish(self, course, assignment): def test_can_find_published(self, course, assignment): assignment.publish(course,overwrite=True) - assert mc.is_assignment_already_uploaded(assignment.name,course) + assert mc.course_interaction_functions.is_assignment_already_uploaded(assignment.name,course) def test_published_has_properties(self, course, assignment): assignment.publish(course,overwrite=True) - on_canvas = mc.find_assignment_in_course(assignment.name,course) + on_canvas = mc.course_interaction_functions.find_assignment_in_course(assignment.name,course) assert on_canvas.points_possible == assignment.points_possible assert 'jpg' in on_canvas.allowed_extensions @@ -71,8 +71,8 @@ def test_doesnt_find_deleted(self, course, assignment): name = assignment.name assignment.publish(course,overwrite=True) - assert mc.is_assignment_already_uploaded(name,course) - f = mc.find_assignment_in_course(name,course) + assert mc.course_interaction_functions.is_assignment_already_uploaded(name,course) + f = mc.course_interaction_functions.find_assignment_in_course(name,course) f.delete() # print([i.name for i in course.get_assignments()]) - assert not mc.is_assignment_already_uploaded(name,course) + assert not mc.course_interaction_functions.is_assignment_already_uploaded(name,course) diff --git a/test/test_droplets.py b/test/test_droplets.py index ca69255..7170bd8 100644 --- a/test/test_droplets.py +++ b/test/test_droplets.py @@ -57,17 +57,17 @@ def test_doesnt_find_deleted(self, course, page): name = page.name page.publish(course,overwrite=True) - assert mc.is_page_already_uploaded(name,course) - f = mc.find_page_in_course(name,course) + assert mc.course_interaction_functions.is_page_already_uploaded(name,course) + f = mc.course_interaction_functions.find_page_in_course(name,course) f.delete() # print([i.name for i in course.get_pages()]) - assert not mc.is_page_already_uploaded(name,course) + assert not mc.course_interaction_functions.is_page_already_uploaded(name,course) def test_can_find_published(self, course, page): page.publish(course,overwrite=True) - assert mc.is_page_already_uploaded(page.name,course) + assert mc.course_interaction_functions.is_page_already_uploaded(page.name,course) diff --git a/test/test_image.py b/test/test_image.py index 9d4f0b3..349ab76 100644 --- a/test/test_image.py +++ b/test/test_image.py @@ -40,20 +40,20 @@ def test_can_publish_image(self, course, image): def test_can_find_published_image(self, course, image): image.publish(course,'images',overwrite=True) - assert mc.is_file_already_uploaded(file_to_publish,course) + assert mc.course_interaction_functions.is_file_already_uploaded(file_to_publish,course) def test_doesnt_find_deleted_image(self, course, image): image.publish(course,'images',overwrite=True) - assert mc.is_file_already_uploaded(file_to_publish,course) - f = mc.find_file_in_course(file_to_publish,course) + assert mc.course_interaction_functions.is_file_already_uploaded(file_to_publish,course) + f = mc.course_interaction_functions.find_file_in_course(file_to_publish,course) f.delete() - assert not mc.is_file_already_uploaded(file_to_publish,course) + assert not mc.course_interaction_functions.is_file_already_uploaded(file_to_publish,course) def test_can_get_already_published_image(self, course, image): # first, definitely publish image.publish(course,'images',overwrite=True) - img_on_canvas = mc.find_file_in_course(file_to_publish,course) + img_on_canvas = mc.course_interaction_functions.find_file_in_course(file_to_publish,course) assert img_on_canvas.filename == filename diff --git a/test/test_link_to_local_file.py b/test/test_link_to_local_file.py index 4dbb790..a63d956 100644 --- a/test/test_link_to_local_file.py +++ b/test/test_link_to_local_file.py @@ -60,17 +60,17 @@ def test_doesnt_find_deleted(self, course, page): name = page.name page.publish(course,overwrite=True) - assert mc.is_page_already_uploaded(name,course) - f = mc.find_page_in_course(name,course) + assert mc.course_interaction_functions.is_page_already_uploaded(name,course) + f = mc.course_interaction_functions.find_page_in_course(name,course) f.delete() # print([i.name for i in course.get_pages()]) - assert not mc.is_page_already_uploaded(name,course) + assert not mc.course_interaction_functions.is_page_already_uploaded(name,course) def test_can_find_published(self, course, page): page.publish(course,overwrite=True) - assert mc.is_page_already_uploaded(page.name,course) + assert mc.course_interaction_functions.is_page_already_uploaded(page.name,course) diff --git a/test/test_page_in_module.py b/test/test_page_in_module.py index 9e50f94..cebe368 100644 --- a/test/test_page_in_module.py +++ b/test/test_page_in_module.py @@ -33,7 +33,7 @@ def destination_modules(page_plain_text_in_a_module): def _delete_test_modules(course, destination_modules): for m in destination_modules: - mc.delete_module(m, course, even_if_doesnt_exist=True) + mc.course_interaction_functions.delete_module(m, course, even_if_doesnt_exist=True) @@ -58,23 +58,23 @@ def test_already_online_raises(self, course, page_plain_text_in_a_module): def test_can_make_modules(self, course, destination_modules): for m in destination_modules: - mc.create_or_get_module(m,course) + mc.course_interaction_functions.create_or_get_module(m,course) def test_can_delete_modules(self, course, destination_modules): _delete_test_modules(course, destination_modules) for m in destination_modules: - mc.create_or_get_module(m,course) + mc.course_interaction_functions.create_or_get_module(m,course) for m in destination_modules: - mc.delete_module(m, course, even_if_doesnt_exist=False) + mc.course_interaction_functions.delete_module(m, course, even_if_doesnt_exist=False) def test_page_in_module_after_publishing(self, course, page_plain_text_in_a_module, destination_modules): page_plain_text_in_a_module.publish(course,overwrite=True) - assert mc.is_page_already_uploaded(page_plain_text_in_a_module.name,course) + assert mc.course_interaction_functions.is_page_already_uploaded(page_plain_text_in_a_module.name,course) page_plain_text_in_a_module.ensure_in_modules(course) @@ -89,15 +89,15 @@ def test_page_in_module_after_publishing(self, course, page_plain_text_in_a_modu # name = self.page.name # self.page.publish(self.course,overwrite=True) - # self.assertTrue(mc.is_page_already_uploaded(name,self.course)) + # self.assertTrue(mc.course_interaction_functions.is_page_already_uploaded(name,self.course)) # f = mc.find_page_in_course(name,self.course) # f.delete() # # print([i.name for i in self.course.get_pages()]) - # self.assertTrue(not mc.is_page_already_uploaded(name,self.course)) + # self.assertTrue(not mc.course_interaction_functions.is_page_already_uploaded(name,self.course)) # def test_zzz_can_find_published(self): # self.page.publish(self.course,overwrite=True) - # self.assertTrue(mc.is_page_already_uploaded(self.page.name,self.course)) + # self.assertTrue(mc.course_interaction_functions.is_page_already_uploaded(self.page.name,self.course)) From fc1308155a7c180a089365d70a2a9544cc9ad7cc Mon Sep 17 00:00:00 2001 From: Allison Beemer <66966224+anbeemer@users.noreply.github.com> Date: Tue, 23 Jul 2024 21:34:49 -0500 Subject: [PATCH 3/5] Added markdown=1 for correct render in unit tests --- test/_styles/custom/header.html | 2 +- test/_styles/generic/header.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/_styles/custom/header.html b/test/_styles/custom/header.html index df618fc..1ea1d39 100644 --- a/test/_styles/custom/header.html +++ b/test/_styles/custom/header.html @@ -2,6 +2,6 @@ -
+
diff --git a/test/_styles/generic/header.html b/test/_styles/generic/header.html index df618fc..1ea1d39 100644 --- a/test/_styles/generic/header.html +++ b/test/_styles/generic/header.html @@ -2,6 +2,6 @@ -
+
From a1399d65bbb5926936519dacb95c7c470e9fa9ee Mon Sep 17 00:00:00 2001 From: Allison Beemer <66966224+anbeemer@users.noreply.github.com> Date: Tue, 23 Jul 2024 21:47:50 -0500 Subject: [PATCH 4/5] Removed date updated test Was using datetime, which caused a problem running in the evening (central). Didn't think the test was worth the trouble. --- test/test_file.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/test_file.py b/test/test_file.py index 66b221a..06cee04 100644 --- a/test/test_file.py +++ b/test/test_file.py @@ -82,7 +82,6 @@ def test_already_online_raises(self, course, content): def test_attributes(self, course, content, current_file): content.publish(course,overwrite=True) assert current_file.filename == 'ds150_course_logo.pdf' - assert current_file.modified_at_date.day == datetime.date.today().day From ee6301fe4cd189aed0d95db58a7664a665f42112 Mon Sep 17 00:00:00 2001 From: Allison Beemer <66966224+anbeemer@users.noreply.github.com> Date: Tue, 23 Jul 2024 21:51:06 -0500 Subject: [PATCH 5/5] Docs related to markdown="1" --- docs/index.rst | 1 + docs/markdown_1.rst | 5 +++++ docs/tutorials/styling_content.rst | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 docs/markdown_1.rst diff --git a/docs/index.rst b/docs/index.rst index 81cf5ea..436dffe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -37,6 +37,7 @@ Notes :caption: Some useful notes on aspects of using the library on_meta_dot_json + markdown_1 making_links_to_existing_content wishlist unit_tests diff --git a/docs/markdown_1.rst b/docs/markdown_1.rst new file mode 100644 index 0000000..e8cd02d --- /dev/null +++ b/docs/markdown_1.rst @@ -0,0 +1,5 @@ +Making sure markdown renders when there is a
+=================================================== + +Any time you have a "
" (in a header, footer, body, etc.) make sure that the option markdown="1" is included. +Otherwise, markdown will not render properly on Canvas. \ No newline at end of file diff --git a/docs/tutorials/styling_content.rst b/docs/tutorials/styling_content.rst index 9e2d77c..c77c368 100644 --- a/docs/tutorials/styling_content.rst +++ b/docs/tutorials/styling_content.rst @@ -39,10 +39,14 @@ I hope they're self-documenting in purpose and content. Here's what's in the `h -
+
+ +Note the markdown="1" included in the
above. Any time you include a
, make sure that this appears. +Otherwise, markdown will not render. + The footer simply closes the `div` I opened in the header: .. code-block:: html