示例#1
0
 def test_university_save_userprofile(self):
     """
     Tests whether the save method for the University class properly
     saves the user profile along with the University object.
     """
     u = University(**self.university_data)
     u.save()
     self.assertEquals(
             u.userprofile.user.username,
             self.university_data['username'])
示例#2
0
 def test_university_save_group(self):
     """
     Tests whether the save method for the University class properly
     initializes the user's group to Universities.
     """
     u = University(**self.university_data)
     u.save()
     # Just one default group
     self.assertEqual(
             u.userprofile.user.groups.all().count(),
             1,
             "University not associated with one and only one group.")
     self.assertEqual(
             u.userprofile.user.groups.all()[0].name,
             u'Universities',
             "University not associated with 'Universities' group.")