Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @pytest.mark.django_db
- @pytest.mark.django_client
- def test_404_nonexistent_program(client):
- user_passwd = 'dummy'
- user = mommy.make(User)
- user.set_password(user_passwd)
- user.save()
- print client.login(username=user.username, password=user_passwd)
- response = client.get("/NONEXISTENT_PROGRAM/")
- print response.content
- # follow the redirections
- while response.status_code == 301 or response.status_code == 302:
- response = client.get(response.get('location'))
- print response.content
- assert response.status_code == 404
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement