Mercurial > public > sg101
comparison bio/tests/test_views.py @ 769:cd3343abca9d
For issue #66, member search function should use GET method.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 22 Jan 2014 20:07:39 -0600 |
parents | 1b1a12abde3b |
children | 9e803323a0d0 |
comparison
equal
deleted
inserted
replaced
768:1b1a12abde3b | 769:cd3343abca9d |
---|---|
36 def testValidName(self): | 36 def testValidName(self): |
37 """ | 37 """ |
38 Test a valid username. | 38 Test a valid username. |
39 """ | 39 """ |
40 | 40 |
41 response = self.client.post(reverse('bio-member_search'), | 41 response = self.client.get(reverse('bio-member_search'), |
42 {'username': self.USERNAME}, | 42 {'username': self.USERNAME}, |
43 follow=True) | 43 follow=True) |
44 | 44 |
45 self.assertEqual(len(response.redirect_chain), 1) | 45 self.assertEqual(len(response.redirect_chain), 1) |
46 if response.redirect_chain: | 46 if response.redirect_chain: |
54 def testInvalidName(self): | 54 def testInvalidName(self): |
55 """ | 55 """ |
56 Test a invalid username. | 56 Test a invalid username. |
57 """ | 57 """ |
58 | 58 |
59 response = self.client.post(reverse('bio-member_search'), | 59 response = self.client.get(reverse('bio-member_search'), |
60 {'username': self.USERNAME + '!'}) | 60 {'username': self.USERNAME + '!'}) |
61 | 61 |
62 self.assertEqual(response.status_code, 200) | 62 self.assertEqual(response.status_code, 200) |
63 self.assertContains(response, "That username does not exist.") | 63 self.assertContains(response, "That username does not exist.") |
64 | 64 |
66 """ | 66 """ |
67 Test a username with a trailing space. | 67 Test a username with a trailing space. |
68 """ | 68 """ |
69 | 69 |
70 try: | 70 try: |
71 response = self.client.post(reverse('bio-member_search'), | 71 response = self.client.get(reverse('bio-member_search'), |
72 {'username': self.USERNAME + ' '}, | 72 {'username': self.USERNAME + ' '}, |
73 follow=True) | 73 follow=True) |
74 except NoReverseMatch: | 74 except NoReverseMatch: |
75 self.fail('bit by a MySQL bug?') | 75 self.fail('bit by a MySQL bug?') |
76 | 76 |