Re: Expected URL with primary key when testing SimpleTestCase.assertRedirects()

2014-06-18 Thread Antonio Alaniz
Thanks, K. I think one of my main issues, after looking at your tests, is that I'm not currently using the client to test the redirect. I have this test as a part of my functional_tests.py, but it sounds like I need to possibly build this into my unit tests as I see your test is in tests.py. I'

Re: Expected URL with primary key when testing SimpleTestCase.assertRedirects()

2014-06-18 Thread Kelvin Wong
This is how I usually do redirect tests: self.assertEqual(response.status_code, 302) self.assertRedirects( response, 'http://testserver' + reverse('pizza:deleted') ) I recommend using named URLs, that way your message_id would be similar to this: reverse('pizza:delete', args=[pi

Expected URL with primary key when testing SimpleTestCase.assertRedirects()

2014-06-17 Thread Antonio Alaniz
I'm testing a redirect that would include the primary key. Can anyone tell me how I can test the redirect URL if it involves the primary key? Will the following work?: self.assertRedirects(response, 'message/(?P\d+)/', 200) -- You received this message because you are subscribed to the Google