Exemplo n.º 1
0
 def test_climate_rec_edit(self):
     climate_rec = DBSession.query(ClimateChangeRecommendation).first()
     resp = self.testapp.get('/climate_rec/{}'.format(climate_rec.id),
                             status=200)
     form = resp.form
     form['text'] = 'Bar'
     admindivs = DBSession.query(AdministrativeDivision) \
         .join(AdminLevelType) \
         .filter(AdminLevelType.mnemonic == u'COU') \
         .filter(AdministrativeDivision.code == 11)
     form['associations'] = [admindiv.id for admindiv in admindivs]
     form.submit(status=302)
Exemplo n.º 2
0
 def test_climate_rec_edit(self):
     climate_rec = DBSession.query(ClimateChangeRecommendation).first()
     resp = self.testapp.get('/climate_rec/{}'
                             .format(climate_rec.id),
                             status=200)
     form = resp.form
     form['text'] = 'Bar'
     admindivs = DBSession.query(AdministrativeDivision) \
         .join(AdminLevelType) \
         .filter(AdminLevelType.mnemonic == u'COU') \
         .filter(AdministrativeDivision.code == 11)
     form['associations'] = [admindiv.id for admindiv in admindivs]
     form.submit(status=302)
Exemplo n.º 3
0
 def test_technical_rec_edit(self):
     technical_rec = DBSession.query(TechnicalRecommendation).first()
     resp = self.testapp.get('/technical_rec/{}'.format(technical_rec.id),
                             status=200)
     form = resp.form
     # here we get ['EQ - HIG'] for associations
     form['associations'] = ['EQ - MED', 'EQ - LOW']
     form.submit(status=302)
Exemplo n.º 4
0
 def test_climate_rec_new(self):
     resp = self.testapp.get('/climate_rec/FL/new', status=200)
     form = resp.form
     form['text'] = 'Bar'
     admindivs = DBSession.query(AdministrativeDivision) \
         .join(AdminLevelType) \
         .filter(AdminLevelType.mnemonic == u'COU')
     form['associations'] = [admindiv.id for admindiv in admindivs]
     form.submit(status=302)
Exemplo n.º 5
0
 def test_technical_rec_edit(self):
     technical_rec = DBSession.query(TechnicalRecommendation).first()
     resp = self.testapp.get('/technical_rec/{}'
                             .format(technical_rec.id),
                             status=200)
     form = resp.form
     # here we get ['EQ - HIG'] for associations
     form['associations'] = ['EQ - MED', 'EQ - LOW']
     form.submit(status=302)
Exemplo n.º 6
0
 def test_climate_rec_new(self):
     resp = self.testapp.get('/climate_rec/FL/new', status=200)
     form = resp.form
     form['text'] = 'Bar'
     admindivs = DBSession.query(AdministrativeDivision) \
         .join(AdminLevelType) \
         .filter(AdminLevelType.mnemonic == u'COU')
     form['associations'] = [admindiv.id for admindiv in admindivs]
     form.submit(status=302)
Exemplo n.º 7
0
    def __call__(self, filename, options):

        # FIXME find a better way to load settings
        settings = load_full_settings('development.ini')

        engine = engine_from_config(settings, 'sqlalchemy.')
        DBSession.configure(bind=engine)

        messages = []

        for rec in DBSession.query(HazardLevel):
            messages.append((rec.title, type(rec).__name__))

        for rec in DBSession.query(HazardType):
            messages.append((rec.title, type(rec).__name__))

        return [
            Message(None, text, None, [], class_name, u'', (filename, 1))
            for text, class_name in messages if text != '' and text is not None
        ]
Exemplo n.º 8
0
    def __call__(self, filename, options):

        # FIXME find a better way to load settings
        settings = load_full_settings('development.ini')

        engine = engine_from_config(settings, 'sqlalchemy.')
        DBSession.configure(bind=engine)

        messages = []

        for rec in DBSession.query(ClimateChangeRecommendation):
            messages.append((rec.text, type(rec).__name__))

        for rec in DBSession.query(HazardCategory):
            messages.append((rec.general_recommendation, type(rec).__name__))

        for rec in DBSession.query(TechnicalRecommendation):
            messages.append((rec.text, type(rec).__name__))
            messages.append((rec.detail, type(rec).__name__))

        return [
            Message(None, text, None, [], class_name, u'', (filename, 1))
            for text, class_name in messages if text != '' and text is not None
        ]