Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. from django.test import Client
  2. from django.test import TestCase
  3. from .views import initdb, supplier_list
  4. from django.core.exceptions import ObjectDoesNotExist
  5.  
  6. class AccoradnceTestCase(TestCase):
  7. def setUp(self):
  8. initdb(3)
  9.  
  10. def test_supplier_id_access(self):
  11. c = Client()
  12. with self.assertRaises(ObjectDoesNotExist) as cm:
  13. response = c.get('/supply/' + str(999) + '/')
  14.  
  15. the_exception = cm.exception
  16. self.assertEqual(isinstance(the_exception, ObjectDoesNotExist), True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement