예제 #1
0
파일: test_models.py 프로젝트: ccnmtl/dmt
    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])
예제 #2
0
파일: test_models.py 프로젝트: ccnmtl/dmt
 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(), [])
예제 #3
0
 def test_guests(self):
     p = ProjectFactory()
     u = UserProfileFactory()
     p.add_guest(u)
     self.assertEqual(p.guests(), [u])
예제 #4
0
 def test_guests_empty(self):
     p = ProjectFactory()
     self.assertEqual(p.guests(), [])