Revision 4f8e7c6d invitations/tests.py

b/invitations/tests.py
89 89
        self.assertEqual(inv.target.max_invitations,
90 90
                         settings.INVITATIONS_PER_LEVEL[1])
91 91

  
92

  
92 93
    def test_invitation_login(self):
93 94
        """
94 95
            Basic login by invitation checks
......
167 168
            self.assertTrue(False)
168 169

  
169 170

  
171
    def test_resend_invitation(self):
172
        """
173
        Tests the resend invitation method
174
        """
175
        inv = self._add_invitation()
176

  
177
        resp = self.client.post("/invitations/resend",
178
                                {'invid':inv.id},
179
                                **{'HTTP_X_AUTH_TOKEN': self.token})
180
        self.assertEquals(resp.status_code, 200)
181

  
182

  
183
        resp = self.client.post("/invitations/resend",
184
                                {'invid':'1;delete from db_invitations;'},
185
                                **{'HTTP_X_AUTH_TOKEN': self.token})
186
        self.assertEquals(resp.status_code, 400)
187

  
188
        resp = self.client.post("/invitations/resend",
189
                                {'invid':inv.id},
190
                                **{'HTTP_X_AUTH_TOKEN': inv.target.auth_token})
191
        self.assertEquals(resp.status_code, 400)
192

  
193

  
170 194
    def _add_invitation(self):
171 195
        source = SynnefoUser.objects.filter(auth_token = self.token)[0]
172 196
        invitations.add_invitation(source, "Test", "test@gmail.com")

Also available in: Unified diff