Friday, November 22, 2013

Re: django tests

Simple, first create a user model and do the following:
 
from django.contrib.auth import User

 class UserProfileTestCase(TestCase):
        def setup(self):
                self.user = User.objects.filter(pk=1)
               
self.userprofile = UserProfile.objects.create(first_name = "Harjot")
       
def test_profile(self):
               
self.assertEqual(self.userprofile.first_name, "Harjot")

add any other not optional fields. Hope it works.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/036ec5e5-cf9a-4bbb-9341-41d75c062595%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate