Beispiel #1
0
 def test_get(self):
     with app.test_request_context():
         r = json.loads(EventREST().get().data)
         self.assertEquals(len(r), 17)
         eid = Event.query(
                 Event.watchword == u'Ундервуд в Улан-Удэ'
                 ).get().key.id()
         r = json.loads(EventREST().get(eid).data)
         self.assertEquals(r['watchword'], u'Ундервуд в Улан-Удэ')
Beispiel #2
0
 def decorator(cls):
     with app.test_request_context():
         if table_name:
             _table_name = table_name
             cls.__table_name = table_name
         else:
             _table_name = cls.__name__.lower()
         new_table = db.get_table(_table_name, primary_id=primary_id, primary_type=primary_type)
         if not cls.__column_fileds__:
             raise Exception('no column fileds defined!')
         if sorted(cls.__column_fileds__.keys()) != sorted(new_table.columns):
             key_list = cls.__column_fileds__.keys()
             map(new_table.create_column, key_list, [cls.__column_fileds__[k] for k in key_list])
         return cls
Beispiel #3
0
 def test_get(self):
     with app.test_request_context():
         r = json.loads(TagREST().get().data)
         self.assertEquals(len(r), 4)
Beispiel #4
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['CSRF_ENABLED'] = False
     with app.test_request_context():
         self.form = JokeForm()