'Test that reindexes libraries when given single library key or a list of library keys'

def test_given_id_list_indexes_libraries(self):

    with mock.patch(self.REINDEX_PATH_LOCATION) as patched_index:
        with mock.patch(self.MODULESTORE_PATCH_LOCATION, mock.Mock(return_value=self.store)):
            call_command('reindex_library', unicode(self._get_lib_key(self.first_lib)))
            self.assertEqual(patched_index.mock_calls, self._build_calls(self.first_lib))
            patched_index.reset_mock()
            call_command('reindex_library', unicode(self._get_lib_key(self.second_lib)))
            self.assertEqual(patched_index.mock_calls, self._build_calls(self.second_lib))
            patched_index.reset_mock()
            call_command('reindex_library', unicode(self._get_lib_key(self.first_lib)), unicode(self._get_lib_key(self.second_lib)))
            expected_calls = self._build_calls(self.first_lib, self.second_lib)
            self.assertEqual(patched_index.mock_calls, expected_calls)
