'First, checks that a student cannot see the gated block when it is gated by the gating block and no
attempt has been made to complete the gating block.
Then, checks that the student can see the gated block after the gating block has been completed.
expected_blocks_before_completion is the set of blocks we expect to be visible to the student
before the student has completed the gating block.
The test data includes one special exam and one non-special block as the gating blocks.'

@ddt.data(('H', 'A', ('course', 'A', 'B', 'C')), ('H', 'ProctoredExam', ('course', 'A', 'B', 'C')))
@ddt.unpack
def test_gated(self, gated_block_ref, gating_block_ref, expected_blocks_before_completion):

    self.course.enable_subsection_gating = True
    self.setup_gated_section(self.blocks[gated_block_ref], self.blocks[gating_block_ref])
    with self.assertNumQueries(8):
        self.get_blocks_and_check_against_expected(self.user, expected_blocks_before_completion)
    self.clear_caches()
    with patch('gating.api._get_subsection_percentage', Mock(return_value=100)):
        lms_gating_api.evaluate_prerequisite(self.course, Mock(location=self.blocks[gating_block_ref].location), self.user)
    with self.assertNumQueries(8):
        self.get_blocks_and_check_against_expected(self.user, self.ALL_BLOCKS_EXCEPT_SPECIAL)
