david / django-invitation-backend (http://code.welldev.org/django-invitation/)
fork of django-invitation
A fork of django-invitation to use the new django-registration-backends branch. See http://bitbucket.org/ubernostrum/django-registr... for the reasons.
Clone this repository (size: 52.2 KB): HTTPS / SSH
$ hg clone http://code.welldev.org/django-invitation-backend
| commit 13: | 19027bb758cf |
| parent 12: | 797ed1fbe4e8 |
| branch: | default |
Added currently failing test that requires server-side check of remaining_invitations
Changed (Δ733 bytes):
raw changeset »
invitation/tests.py (12 lines added, 0 lines removed)
Up to file-list invitation/tests.py:
| … | … | @@ -149,12 +149,24 @@ class InvitationViewTests(InvitationTest |
149 |
149 |
self.failUnless(response.context['form']) |
150 |
150 |
self.failUnless(response.context['form'].errors) |
151 |
151 |
|
152 |
# Valid email data succeeds. |
|
152 |
153 |
response = self.client.post(reverse('invitation_invite'), |
153 |
154 |
data={ 'email': 'foo@example.com' }) |
154 |
155 |
self.assertEqual(response.status_code, 302) |
155 |
156 |
self.assertEqual(response['Location'], 'http://testserver%s' % reverse('invitation_complete')) |
156 |
157 |
self.assertEqual(InvitationKey.objects.count(), 3) |
157 |
158 |
self.assertEqual(InvitationKey.objects.remaining_invitations_for_user(self.sample_user), remaining_invitations-1) |
159 |
||
160 |
# Once remaining invitations exhausted, you fail again. |
|
161 |
while InvitationKey.objects.remaining_invitations_for_user(self.sample_user) > 0: |
|
162 |
self.client.post(reverse('invitation_invite'), |
|
163 |
data={'email': 'foo@example.com'}) |
|
164 |
self.assertEqual(InvitationKey.objects.remaining_invitations_for_user(self.sample_user), 0) |
|
165 |
response = self.client.post(reverse('invitation_invite'), |
|
166 |
data={'email': 'foo@example.com'}) |
|
167 |
self.assertEqual(response.status_code, 200) |
|
168 |
self.assertEqual(response.context['remaining_invitations'], 0) |
|
169 |
self.failUnless(response.context['form']) |
|
158 |
170 |
|
159 |
171 |
def test_activated_view(self): |
160 |
172 |
""" |
