示例#1
0
    def test_save_required_only(self):
        form = VegUserCreationForm({'username': '******',
                                    'password1': 'test123',
                                    'password2': 'test123',
                                    'email': '*****@*****.**'})

        form.save()
        user = User.objects.get(username='******')
        self.assertEqual(user.email, '*****@*****.**')
        self.assertEqual(user.get_profile().mailing_list, False)
        self.assertEqual(user.get_profile().bio, '')
示例#2
0
    def test_save_all(self):
        form = VegUserCreationForm({'username': '******',
                                    'password1': 'test123',
                                    'password2': 'test123',
                                    'email': '*****@*****.**',
                                    'bio': "Big veggie lover.",
                                    'mailing_list': 'on'})

        form.save()
        user = User.objects.get(username='******')
        self.assertEqual(user.get_profile().mailing_list, True)
        self.assertEqual(user.get_profile().bio, 'Big veggie lover.')