def test_all_users_not_in_project(self):
     p = ProjectFactory()
     u1 = UserProfileFactory(status='active')
     u2 = UserProfileFactory(status='active')
     p.add_manager(u1)
     self.assertTrue(u2 in p.all_users_not_in_project())
     self.assertFalse(u1 in p.all_users_not_in_project())
 def test_email_post(self):
     p = ProjectFactory()
     n = NodeFactory(subject="\r\n \r\n linebreaks", project=p)
     u2 = UserProfileFactory(status='active')
     p.add_manager(u2)
     p.email_post(n, "a body", n.user.userprofile)
     self.assertEqual(len(mail.outbox), 1)
Example #3
0
 def test_managers(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]))
Example #4
0
 def test_personnel_in_project_sorts_groups_first(self):
     p = ProjectFactory()
     u = UserProfileFactory()
     g = GroupFactory()
     p.add_manager(u)
     p.add_manager(g.grp)
     r = p.personnel_in_project()
     self.assertEqual(set(r), set([g.grp, u, p.caretaker_user.userprofile,
                                   p.project_manager_user.userprofile]))
Example #5
0
 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_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(p.managers(), [p.caretaker_user.userprofile])
        self.assertEqual(p.developers(), [u])
        self.assertEqual(p.guests(), [])
        p.add_guest(u)
        self.assertEqual(p.managers(), [p.caretaker_user.userprofile])
        self.assertEqual(p.developers(), [])
        self.assertEqual(p.guests(), [u])

        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(
            p.managers(),
            [p.caretaker_user.userprofile, p.project_manager_user.userprofile])
        self.assertEqual(p.developers(), [u])
        self.assertEqual(p.guests(), [])
        p.add_guest(u)
        self.assertEqual(
            p.managers(),
            [p.caretaker_user.userprofile, p.project_manager_user.userprofile])
        self.assertEqual(p.developers(), [])
        self.assertEqual(p.guests(), [u])
 def test_all_personnel_in_project(self):
     p = ProjectFactory()
     g = GroupFactory()
     p.add_manager(g.grp)
     self.assertTrue(g.username in p.all_personnel_in_project())