コード例 #1
0
ファイル: test_settings.py プロジェクト: wrestrtdr/Inboxen
    def test_form_good_data(self):
        params = {"username": self.user.username}
        request = MockRequest(self.user)
        form = DeleteAccountForm(request, data=params)

        self.assertTrue(form.is_valid())

        form.save()

        self.assertEqual(request.user, AnonymousUser())
        messages = list(request._messages)
        self.assertEqual(str(messages[0]), "Account deleted. Thanks for using our service.")
コード例 #2
0
ファイル: test_settings.py プロジェクト: Inboxen/Inboxen
    def test_form_good_data(self):
        params = {"username": self.user.username}
        request = MockRequest(self.user)
        form = DeleteAccountForm(request, data=params)

        self.assertTrue(form.is_valid())

        form.save()

        self.assertEqual(request.user, AnonymousUser())
        messages = list(request._messages)
        self.assertEqual(str(messages[0]), "Account deleted. Thanks for using our service.")
コード例 #3
0
ファイル: test_settings.py プロジェクト: wrestrtdr/Inboxen
    def test_form_bad_data(self):
        params = {"username": "******" + self.user.username}
        request = MockRequest(self.user)
        form = DeleteAccountForm(request, data=params)

        self.assertFalse(form.is_valid())
コード例 #4
0
ファイル: test_settings.py プロジェクト: Inboxen/Inboxen
    def test_form_bad_data(self):
        params = {"username": "******" + self.user.username}
        request = MockRequest(self.user)
        form = DeleteAccountForm(request, data=params)

        self.assertFalse(form.is_valid())