'Test search with usage ids.'

@ddt.data('?usage_id=dummy-usage-id-0', '?usage_id=dummy-usage-id-0&usage_id=dummy-usage-id-1&dummy-usage-id-2&dummy-usage-id-3&dummy-usage-id-4')
def test_search_usage_ids(self, usage_ids):

    url = (self._get_url('api/v1/search') + usage_ids)
    response = requests.get(url, params={'user': 'dummy-user-id', 'course_id': 'dummy-course-id'})
    self.assertTrue(response.ok)
    response = response.json()
    parsed = urlparse.urlparse(url)
    query_params = urlparse.parse_qs(parsed.query)
    query_params['usage_id'].reverse()
    self.assertEqual(len(response), len(query_params['usage_id']))
    for (index, usage_id) in enumerate(query_params['usage_id']):
        self.assertEqual(response[index]['usage_id'], usage_id)
