Beispiel #1
0
 def delete(self, oid):
     try:
         Build.query.filter(Build.id == oid).delete()
         db_session.commit()
         return True, 204
     except Exception as e:
         print e
         return '', 500
Beispiel #2
0
    def post(self):
        build = json.loads(request.data, object_hook=Build.decode)
        try:
            db_session.add(build)
            db_session.commit()
        except Exception as e:
            print e
        return JsonUtil.objectToJson(build), 201
#         return '', 201
 def test_insert_user(self):
     db_session.add_all([
                      User('wendy', 'foobar', True),
                      User('mary', 'passwd', False),
                      User('fred', 'blah', True)])
     db_session.commit()
     user = User.query.filter(User.id == 1).first()
     print user
     user = User.query.filter(User.id == 12).first()
     print user
Beispiel #4
0
    def put(self, oid):
        build = json.loads(request.data, object_hook=Build.decode)

        try:
            build = db_session.merge(build)
            db_session.commit()
        except Exception as e:
           #TODO: log exception
           print e
        return JsonUtil.objectToJson(build), 201
 def test_insert_user(self):
     db_session.add_all([
         User('wendy', 'foobar', True),
         User('mary', 'passwd', False),
         User('fred', 'blah', True)
     ])
     db_session.commit()
     user = User.query.filter(User.id == 1).first()
     print user
     user = User.query.filter(User.id == 12).first()
     print user
Beispiel #6
0
 def test_insert_user(self):
     db_session.add_all(
         [
             User("*****@*****.**", "foobar", True),
             User("*****@*****.**", "passwd", False),
             User("*****@*****.**", "blah", True),
         ]
     )
     db_session.commit()
     user = User.query.filter(User.id == 1).first()
     print user
     user = User.query.filter(User.id == 12).first()
     print user
Beispiel #7
0
    def test_insert(self):
 
        t1 = Build('BDR-64423', '234567', '13.4', 'dev1')
        db_session.add(t1)
        db_session.commit()