Exemple #1
0
    def setUp(self):
        super(TestFriendResource, self).setUp()
        self.client = Client()
        p_fdata = {'semester'   : '09C'
                 , 'type'       : 'science'
                 , 'pcode'      : 'mike'
                 , 'name'       : 'mikes awesome project!'
                 , 'PSC_time'   : '100.0'
                 , 'total_time' : '100.0'
                 , 'sem_time'   : '50.0'
                   }
        self.p = Project()
        p_adapter = ProjectHttpAdapter(self.p)
        p_adapter.init_from_post(p_fdata)
        self.p.save()

        self.users = create_users()

        self.friends = []
        # first user is a friend to the project
        self.friends.append(Friend(project = self.p
                             , user        = self.users[0]
                                   ))
        self.friends[-1].save()
        # second user is also a friend to the project
        self.friends.append(Friend(project = self.p
                                   , user  = self.users[1]
                                   ))
        self.friends[-1].save()

        self.fdata = {'name'       : self.users[-1].last_name
                    , 'project_id' : self.p.id
                    , 'user_id'    : self.users[-1].id
                     }
    def setUp(self):
        super(TestInvestigatorResource, self).setUp()
        self.client = Client()
        p_fdata = {'semester'   : '09C'
                 , 'type'       : 'science'
                 , 'pcode'      : 'mike'
                 , 'name'       : 'mikes awesome project!'
                 , 'PSC_time'   : '100.0'
                 , 'total_time' : '100.0'
                 , 'sem_time'   : '50.0'
                   }
        self.p = Project()
        p_adapter = ProjectHttpAdapter(self.p)
        p_adapter.init_from_post(p_fdata)
        self.p.save()

        self.users = create_users()
        self.ins = []
        self.ins.append(Investigator(project                = self.p
                                   , user                   = self.users[0]
                                   , observer               = True
                                   , principal_contact      = False
                                   , principal_investigator = False
                                   , priority               = 2
                                   ))
        self.ins[-1].save()
        self.ins.append(Investigator(project                = self.p
                                   , user                   = self.users[1]
                                   , observer               = True
                                   , principal_contact      = True
                                   , principal_investigator = True
                                   , priority               = 1
                                   ))
        self.ins[-1].save()
        self.fdata = {'name'       : self.users[-1].last_name
                    , 'pi'         : 'False'
                    , 'contact'    : 'False'
                    , 'remote'     : 'False'
                    , 'project_id' : self.p.id
                    , 'user_id'    : self.users[-1].id
                    , 'observer'   : 'true'
                    , 'priority'   : 1
                     }
Exemple #3
0
 def setUp(self):
     super(TestUserResource, self).setUp()
     self.client = Client()
     self.fdata = {
                   }
     self.users = create_users()