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

@ddt.data(({}, status.HTTP_400_BAD_REQUEST, 'master_course_id_not_provided', 'auth_header_oauth2_provider'), ({}, status.HTTP_400_BAD_REQUEST, 'master_course_id_not_provided', 'auth'), ({'master_course_id': None}, status.HTTP_400_BAD_REQUEST, 'master_course_id_not_provided', 'auth_header_oauth2_provider'), ({'master_course_id': None}, status.HTTP_400_BAD_REQUEST, 'master_course_id_not_provided', 'auth'), ({'master_course_id': ''}, status.HTTP_400_BAD_REQUEST, 'course_id_not_valid', 'auth_header_oauth2_provider'), ({'master_course_id': ''}, status.HTTP_400_BAD_REQUEST, 'course_id_not_valid', 'auth'), ({'master_course_id': 'invalid_master_course_str'}, status.HTTP_400_BAD_REQUEST, 'course_id_not_valid', 'auth'), ({'master_course_id': 'invalid_master_course_str'}, status.HTTP_400_BAD_REQUEST, 'course_id_not_valid', 'auth_header_oauth2_provider'), ({'master_course_id': 'course-v1:org_foo.0+course_bar_0+Run_0'}, status.HTTP_404_NOT_FOUND, 'course_id_does_not_exist', 'auth'), ({'master_course_id': 'course-v1:org_foo.0+course_bar_0+Run_0'}, status.HTTP_404_NOT_FOUND, 'course_id_does_not_exist', 'auth_header_oauth2_provider'))
@ddt.unpack
def test_post_list_wrong_master_course(self, data, expected_http_error, expected_error_string, 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.post(self.list_url, data, format='json', HTTP_AUTHORIZATION=getattr(self, auth_attr))
        self.expect_error(expected_http_error, expected_error_string, resp)
