def json(self): return { 'id': self.id, 'name': self.forename, 'last_name': self.surname, 'gender': self.gender, 'date_of_birth': str(self.dob), 'active': self.is_active(), 'username': self.epfusername, 'epf_username': self.epfusername, 'email': self.email, 'title': get_title(self.title), 'language': self.language, 'nationality': self.nationality, 'profession': self.profession, 'private': self.private, 'students': [gidsid.json() for gidsid in self.gidsids], }
def json(self): return { 'id': self.id, 'name': self.forename, 'last_name': self.surname, 'date_of_birth': str(self.dob), 'active': self.is_active(), 'username': self.username, 'epf_username': self.epfusername, 'email': self.email, 'title': get_title(self.title), 'language': self.language, 'role': self.role, 'personal_email': self.personalemail, 'mobile_phone': str(self.mobilephone), 'classes': [teaching_class.class_id for teaching_class in self.classes], 'communities': [permission.group.community_id for permission in self.permissions if permission.is_community()], 'yeargroups': [permission.group.yeargroup_id for permission in self.permissions if permission.is_yeargroup()], }
def test_get_title_1000_returns_empty_string(self): self.assertEqual(get_title(1000), '')
def test_get_title_string_returns_empty_string(self): self.assertEqual(get_title('test'), '')
def test_get_title_1_returns_mr(self): self.assertEqual(get_title(1), 'mr')