Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests for #556. #783

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/base_test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"hidden": False,
"listed": True,
"accepts_enrollment": True,
"git_source": "git://github.com/inducer/relate-sample",
"git_source": "git://github.com/dzhuang/relate-sample",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This need to be reverted when merging.

"course_file": "course.yml",
"events_file": "events.yml",
"enrollment_approval_required": False,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,8 @@ def test_load_not_yaml(self):
with self.pctx.repo as repo:
loader = content.YamlBlockEscapingGitTemplateLoader(
repo, self.course.active_git_commit_sha.encode())
result = loader.get_source(environment, "content-macros.jinja")
result = loader.get_source(environment,
"macros/content-macros.jinja")
source, _, _ = result
self.assertIsNotNone(source)
self.assertTrue(source.startswith(
Expand Down
12 changes: 12 additions & 0 deletions tests/test_sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,15 @@ def test_preview_failed(self):
self.assertEqual(resp.status_code, 200)
self.assertAddMessageCallCount(1)
self.assertAddMessageCalledWith(error_msg)

def test_subdir_macro_render(self):
# Test https://github.com/inducer/relate/pull/556
# Also see https://github.com/inducer/relate/issues/767
markup_content = """
{% from "macros/test/test-macro.jinja" import button %}
{{ button("flow:exam-1") }}"""
resp = self.post_markup_sandbox_view(markup_content=markup_content)
self.assertEqual(resp.status_code, 200)
self.assertContains(
resp, "/course/%s/flow/exam-1/start" % self.course.identifier,
status_code=200)