'Test that all textbooks tab links generating correctly.'

def test_pdf_textbook_tabs(self):

    type_to_reverse_name = {'textbook': 'book', 'pdftextbook': 'pdf_book', 'htmltextbook': 'html_book'}
    request = get_mock_request(self.user)
    course_tab_list = get_course_tab_list(request, self.course)
    num_of_textbooks_found = 0
    for tab in course_tab_list:
        if (tab.type == 'single_textbook'):
            (book_type, book_index) = tab.tab_id.split('/', 1)
            expected_link = reverse(type_to_reverse_name[book_type], args=[self.course.id.to_deprecated_string(), book_index])
            tab_link = tab.link_func(self.course, reverse)
            self.assertEqual(tab_link, expected_link)
            num_of_textbooks_found += 1
    self.assertEqual(num_of_textbooks_found, self.num_textbooks)
