'The view should return status 404 if the enrollment username does not match the username of the user
making the request, unless the request is made by a staff user or with a server API key.'

def test_user_does_not_match_param(self):

    CourseModeFactory.create(course_id=self.course.id, mode_slug=CourseMode.HONOR, mode_display_name=CourseMode.HONOR)
    url = reverse('courseenrollment', kwargs={'username': self.other_user.username, 'course_id': unicode(self.course.id)})
    response = self.client.get(url)
    self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
    self.client.logout()
    response = self.client.get(url, **{'HTTP_X_EDX_API_KEY': self.API_KEY})
    self.assertEqual(response.status_code, status.HTTP_200_OK)
    staff_user = UserFactory.create(password=self.PASSWORD, is_staff=True)
    self.client.login(username=staff_user.username, password=self.PASSWORD)
    response = self.client.get(url)
    self.assertEqual(response.status_code, status.HTTP_200_OK)
