Add unit tests for instructor tool - #50
Conversation
|
@e-kolpakov Could you please have a look at what I have so far? With the unit test introduced by 1f603db I'm verifying that individual questions are represented correctly in the root block dropdown. The basic idea is to check whether the ... where Maybe there's a simpler approach? I haven't worked with the CC @antoviaque |
a909afa to
1f603db
Compare
|
@itsjeyd I believe the test tests too much:
I can see two ways to improve (and potentially simplify) it:
Since we have an idea to have less integration and more unit tests I would go for option 2. It lacks testing that template does what it supposed to do, but I don't know any way to test templates except integration tests (if you happen to know one - share the knowledge :)) |
|
@e-kolpakov Thanks for the feedback! I went for option 2. If you could have a quick look to see if the changes match what you had in mind, that would be great :) |
33cf296 to
bb3c01c
Compare
|
@e-kolpakov I added six more unit tests and two integration tests addressing issues that came up for #47. Please review. :) |
There was a problem hiding this comment.
@itsjeyd nit: could use a helper method:
def check_block(usage_id, expected_name):
matching_blocks = [block for block in block_tree if block['id'] == self.block.scope_ids.usage_id]
self.assertEqual(len(matching_blocks), 1)
matching_block = matching_blocks[0]
self.assertEqual(matching_block['name'], expected_name)
|
@e-kolpakov Thanks for the comments! I addressed them all. Please have another look at the code. |
|
@itsjeyd 👍 |
previous PR (#47). The new tests check if: - preferred block attrs are used when building block tree for current course - block tree excludes pb-choice blocks - blocks are correctly marked as (in)eligible - new-style keys are handled correctly - student_view passes calls rendering method with correct template args - author_view and studio_view show appropriate messages
53f78db to
66e6762
Compare
Add unit tests for instructor tool
This PR aims to extend unit test coverage for problem-builder by introducing unit tests for the Instructor Tool block.
It follows up on #47.