Mike Dewhirst
unread,Aug 5, 2018, 11:45:50 PM8/5/18Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I have a test which succeeds in development but fails with Apache in
staging ...
Here is the test ...
def test_course_view_not_found_status_code(self):
# no course exists with pk of 99
response = self.client.get(reverse('course:course_view',
kwargs={'pk': 99}))
self.assertEquals(response.status_code, 404)
The status code from the staging server with Apache is 301 <-- Huh?
The test class tearDown() deletes all courses between each test.
Here is the view ...
def course_view(request, pk=None):
course = get_object_or_404(Course, pk=pk)
# login is needed if there are questions/answers
if course.login_needed or request.user.is_authenticated:
return course_login_required(request, course=course)
else:
return course_login_not_required(request, course=course)
What am I doing wrong?
Thanks
Mike