'Test for various get requests with wrong master course string'

@ddt.data(*AUTH_ATTRS)
def test_get_list_wrong_master_course(self, auth_attr):

    mock_class_str = 'openedx.core.lib.api.permissions.IsMasterCourseStaffInstructor.has_permission'
    with mock.patch(mock_class_str, autospec=True) as mocked_perm_class:
        mocked_perm_class.return_value = True
        resp = self.client.get(self.list_url, {}, HTTP_AUTHORIZATION=getattr(self, auth_attr))
        self.expect_error(status.HTTP_400_BAD_REQUEST, 'master_course_id_not_provided', resp)
        base_url = urlparse.urljoin(self.list_url, '?master_course_id=')
        resp = self.client.get(base_url, {}, HTTP_AUTHORIZATION=getattr(self, auth_attr))
        self.expect_error(status.HTTP_400_BAD_REQUEST, 'course_id_not_valid', resp)
        url = '{0}invalid_master_course_str'.format(base_url)
        resp = self.client.get(url, {}, HTTP_AUTHORIZATION=getattr(self, auth_attr))
        self.expect_error(status.HTTP_400_BAD_REQUEST, 'course_id_not_valid', resp)
        url = '{0}course-v1%3Aorg_foo.0%2Bcourse_bar_0%2BRun_0'.format(base_url)
        resp = self.client.get(url, {}, HTTP_AUTHORIZATION=getattr(self, auth_attr))
        self.expect_error(status.HTTP_404_NOT_FOUND, 'course_id_does_not_exist', resp)
