Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.test import TestCase
- class DocumentViewTest(TestCase):
- def setUp(self):
- # Create 3 users
- def test_view_url_exists_at_desired_location(self):
- self.client.login(username='manager', password='xx')
- resp = self.client.get(reverse('view_upload'))
- self.assertEqual(str(resp.context['user']), 'manager')
- from django.test import TestCase
- class DocumentViewTest(TestCase):
- def setUp(self):
- # Create 3 users
- def test_view_url_exists_at_desired_location(self):
- self.client.login(username=['manager','admin','simple_user'], password=['xx','x','xxx'])
- resp_manager, resp_admin, resp_simple_user = self.client.get(reverse('view_upload'))
- self.assertEqual(str(resp_manager.context['user']), 'manager')
- self.assertEqual(str(resp_admin.context['user']), 'admin')
- self.assertEqual(str(resp.resp_simple_user['user']), 'simple_user')
Add Comment
Please, Sign In to add comment