-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add unit test to xblock so there is a coverage file to upload (#426
- Loading branch information
Rebecca Graber
authored
Dec 18, 2023
1 parent
2915cb8
commit b3ad3b4
Showing
4 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
cookiecutter-xblock/{{cookiecutter.repo_name}}/tests/test_{{cookiecutter.package_name}}.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
Tests for {{cookiecutter.class_name}} | ||
""" | ||
|
||
from django.test import TestCase | ||
from xblock.fields import ScopeIds | ||
from xblock.test.toy_runtime import ToyRuntime | ||
|
||
from my_xblock import MyXBlock | ||
|
||
|
||
class Test{{cookiecutter.class_name}}(TestCase): | ||
"""Tests for {{cookiecutter.class_name}}""" | ||
def test_my_student_view(self): | ||
"""Test the basic view loads.""" | ||
scope_ids = ScopeIds('1', '2', '3', '4') | ||
block = MyXBlock(ToyRuntime(), scope_ids=scope_ids) | ||
frag = block.student_view() | ||
as_dict = frag.to_dict() | ||
content = as_dict['content'] | ||
self.assertIn('MyXBlock: count is now', content, 'XBlock did not render correct student view') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters