コード例 #1
0
 def test_send(self, post):
     form = PasswordRecoveryForm({"email": "*****@*****.**", "token": "token"})
     form.is_valid()
     form.send()
     url = "{0}/users/{1}/password?token={2}".format(
         settings.TSURU_HOST,
         form.cleaned_data["email"],
         form.cleaned_data["token"]
     )
     post.assert_called_with(url)
コード例 #2
0
 def test_send(self, post):
     form = PasswordRecoveryForm({"email": "*****@*****.**", "token": "token"})
     form.is_valid()
     form.send()
     url = "{0}/users/{1}/password?token={2}".format(
         settings.TSURU_HOST, form.cleaned_data["email"],
         form.cleaned_data["token"])
     post.assert_called_with(url)
コード例 #3
0
 def test_email_is_required(self):
     form = PasswordRecoveryForm({"token": "token"})
     self.assertFalse(form.is_valid())
コード例 #4
0
 def test_valid(self):
     form = PasswordRecoveryForm({"email": "*****@*****.**", "token": "token"})
     self.assertTrue(form.is_valid())
コード例 #5
0
    def test_email_should_be_an_email(self):
        invalid_emails = ["a", "a@a", "a@a."]

        for email in invalid_emails:
            form = PasswordRecoveryForm({"email": email, "token": "token"})
            self.assertFalse(form.is_valid())
コード例 #6
0
 def test_token_is_required(self):
     form = PasswordRecoveryForm({"email": "*****@*****.**"})
     self.assertFalse(form.is_valid())
コード例 #7
0
 def test_email_is_required(self):
     form = PasswordRecoveryForm({"token": "token"})
     self.assertFalse(form.is_valid())
コード例 #8
0
 def test_valid(self):
     form = PasswordRecoveryForm({"email": "*****@*****.**", "token": "token"})
     self.assertTrue(form.is_valid())
コード例 #9
0
    def test_email_should_be_an_email(self):
        invalid_emails = ["a", "a@a", "a@a."]

        for email in invalid_emails:
            form = PasswordRecoveryForm({"email": email, "token": "token"})
            self.assertFalse(form.is_valid())
コード例 #10
0
 def test_token_is_required(self):
     form = PasswordRecoveryForm({"email": "*****@*****.**"})
     self.assertFalse(form.is_valid())