def test_only_one_role_allowed(self): p = ProjectFactory() u = UserProfileFactory() p.add_manager(u) self.assertEqual(set(p.managers()), set([u, p.caretaker_user.userprofile, p.project_manager_user.userprofile])) self.assertEqual(p.developers(), []) self.assertEqual(p.guests(), []) p.add_developer(u) self.assertEqual(set(p.managers()), set([p.caretaker_user.userprofile, p.project_manager_user.userprofile])) self.assertEqual(p.developers(), [u]) self.assertEqual(p.guests(), []) p.add_guest(u) self.assertEqual(set(p.managers()), set([p.caretaker_user.userprofile, p.project_manager_user.userprofile])) self.assertEqual(p.developers(), []) self.assertEqual(p.guests(), [u]) p.add_developer(u) self.assertEqual(set(p.managers()), set([p.caretaker_user.userprofile, p.project_manager_user.userprofile])) self.assertEqual(p.developers(), [u]) self.assertEqual(p.guests(), []) p.add_guest(u) self.assertEqual(set(p.managers()), set([p.caretaker_user.userprofile, p.project_manager_user.userprofile])) self.assertEqual(p.developers(), []) self.assertEqual(p.guests(), [u])
def test_remove_personnel(self): p = ProjectFactory() u = UserProfileFactory() p.add_manager(u) self.assertEqual( set(p.managers()), set([u, p.caretaker_user.userprofile, p.project_manager_user.userprofile])) p.remove_personnel(u) self.assertEqual( set(p.managers()), set([p.caretaker_user.userprofile, p.project_manager_user.userprofile])) self.assertEqual(p.developers(), []) self.assertEqual(p.guests(), [])
def test_guests(self): p = ProjectFactory() u = UserProfileFactory() p.add_guest(u) self.assertEqual(p.guests(), [u])
def test_guests_empty(self): p = ProjectFactory() self.assertEqual(p.guests(), [])