'Verify that the teams discussion component is in the correct state
for the test user. If `should_have_permission` is True, assert that
the user can see controls for posting replies, voting, editing, and
deleting. Otherwise, assert that those controls are hidden.'

def verify_teams_discussion_permissions(self, should_have_permission):

    thread = self.setup_thread()
    self.team_page.visit()
    self.assertEqual(self.team_page.discussion_id, self.teams[0]['discussion_topic_id'])
    discussion_page = self.team_page.discussion_page
    discussion_page.wait_for_page()
    self.assertTrue(discussion_page.is_discussion_expanded())
    self.assertEqual(discussion_page.get_num_displayed_threads(), 1)
    discussion_page.show_thread(thread['id'])
    thread_page = discussion_page.thread_page
    assertion = (self.assertTrue if should_have_permission else self.assertFalse)
    assertion(thread_page.q(css='.post-header-actions').present)
    assertion(thread_page.q(css='.add-response').present)
