コード例 #1
0
 def test_add_application_with_sa_to_project(self):
     session = DBSession()
     project = Project(name=u'My project 1')
     application = Application(name=u'Trac')
     project.add_application(application)
     session.add(project)
     transaction.commit()
     self.assertEqual(session.query(Project).filter_by(name=u'My project 1').first().applications[0].name, u'Trac')
コード例 #2
0
 def test_add_application_to_project(self):
     session = DBSession()
     project = Project(name=u'My project 2')
     application = Application(name=u'Trac', api_uri='http://simple.api.uri')
     project.add_application(application)
     session.add(project)
     transaction.commit()
     self.assertEqual(session.query(Project).filter_by(name=u'My project 2').first().applications[0].name, u'Trac')
コード例 #3
0
ファイル: test_tp.py プロジェクト: getpenelope/por.models
 def test_project_modification_date(self):
     project_name = u'C project'
     session = DBSession()
     project = Project(name=project_name)
     session.add(project)
     transaction.commit()
     project = session.query(Project).filter_by(name=project_name).first()
     old_date = project.modification_date
     project.name = u'A modified project'
     time.sleep(0.1)
     transaction.commit()
     project = session.query(Project).filter_by(name=u'A modified project').first()
     new_date = project.modification_date
     self.assertNotEqual(old_date, new_date)
コード例 #4
0
ファイル: test_api.py プロジェクト: getpenelope/por.dashboard
    def test_project_attributes(self):
        project_name = u'Another nice project'
        customer_name = u'A very good customer'
        session = DBSession()
        project = Project(name=project_name)
        customer = Customer(name=customer_name)
        customer.add_project(project)
        applications1 = Application(name=u'Trac')
        applications2 = Application(name=u'Svn')
        customerR1 = CustomerRequest(name=u'A bad request')
        customerR2 = CustomerRequest(name=u'A good request')
        project.add_application(applications1)
        project.add_application(applications2)
        project.add_customer_request(customerR1)
        project.add_customer_request(customerR2)
        session.add(customer)
        transaction.commit()

        resp = self.proxy.get_project_by_name(project_name)
        self.assertTrue(u'Trac' in resp['applications'])
        self.assertTrue(u'another-nice-project_1' in [item for sublist in resp['customer_requests'] for item in sublist])
        self.assertTrue(u'another-nice-project_2' in [item for sublist in resp['customer_requests'] for item in sublist])
        self.assertTrue(2, len(resp['customer_requests']))
        self.assertTrue(2, len(resp['applications']))
コード例 #5
0
 def test_add_duplicated_applications(self):
     project = Project(name=u'My project 3')
     application = Application(name=u'Trac')
     project.add_application(application)
     self.assertRaises(AttributeError, project.add_application,application)