def test_registration(self): # The registration view calls render with a context that has a # contacts_table that has the contacts in its data request = HttpRequest() request.GET = QueryDict('') with patch('rapidsms.contrib.registration.views.render') as render: views.registration(request) context = render.call_args[0][2] table = context["contacts_table"] self.assertEqual(len(self.contacts), len(list(table.data.queryset)))
def test_registration_render(self): # render actually works (django_tables2 and all) request = HttpRequest() request.GET = QueryDict('') self.login() request.user = self.user retval = views.registration(request) self.assertEqual(200, retval.status_code)