コード例 #1
0
 def test_phase(self):
         c = getDB()
         one = 'test 1'
         two = 'test 1'
         c.execute("""INSERT INTO columns(proj,coll) VALUES(?,?)""",(two,one))
         name = str(c.execute("""SELECT proj,coll FROM columns WHERE proj = 'test 1' AND coll = 'test 1' """).fetchall())
         self.assertEqual(name,"[('test 1', 'test 1')]")
コード例 #2
0
 def test_project(self):
         c = getDB()
         one = 'test 1'
         two = 'test 1'
         three = 'test 1'
         c.execute("""INSERT INTO project(manager,title,description) VALUES(?,?,?)""",(three,one,two))
         name = str(c.execute("""SELECT manager,title,description FROM project WHERE description = 'test 1' AND title = 'test 1' AND manager = 'test 1' """).fetchall())
         self.assertEqual(name,"[('test 1', 'test 1', 'test 1')]")
コード例 #3
0
 def test_bug(self):
         c = getDB()
         one = 1
         two = 'test 1'
         three = 'test 1'
         four = 'test 1'
         c.execute("""INSERT INTO bug(task_id,line,fname,description) VALUES(?,?,?,?)""",(one,two,three,four))
         name = str(c.execute("""SELECT task_id,line,fname,description FROM bug WHERE task_id = 1 AND description = 'test 1' AND line = 'test 1' AND fname = 'test 1' """).fetchall())
         self.assertEqual(name,"[(1, 'test 1', 'test 1', 'test 1')]")
コード例 #4
0
 def test_task(self):
         c = getDB()
         language = 'test 1'
         two = 'test 1'
         three = 'test 1'
         c.execute("""INSERT INTO task(title,description,phase) VALUES(?,?,?)""",(language,two,three,))
         
         name = str(c.execute("""SELECT title,description,phase FROM task WHERE title = 'test 1' AND description = 'test 1' AND phase = 'test 1'""").fetchall())
         self.assertEqual(name,"[('test 1', 'test 1', 'test 1')]")
コード例 #5
0
ファイル: test.py プロジェクト: S2-D/project-MedicalBlindSpot
from flask import Flask, Blueprint, jsonify, request
from flask_restful import reqparse, abort, Api, Resource
from config import DB_CONNECT
from app import getDB

bp = Blueprint('test', __name__, url_prefix='/test')
api = Api(bp)
db = getDB()
cursor = db.cursor()

question_parser = reqparse.RequestParser()
question_parser.add_argument('question_id')

user_parser = reqparse.RequestParser()
user_parser.add_argument('id')
user_parser.add_argument('user_name')
user_parser.add_argument('user_age')
user_parser.add_argument('user_gender')
user_parser.add_argument('user_region')

# score_parser = reqparse.RequestParser()
# score_parser.add_argument('user_id')

code_parser = reqparse.RequestParser()
code_parser.add_argument('code_id')


class Question(Resource):
    def get(self):
        result = []
        args = question_parser.parse_args()
コード例 #6
0
 def test_user(self):
     c = getDB()
     one = 'test 1'
     c.execute("""INSERT INTO user(uname) VALUES (?)""",(one,))
     name = str(c.execute("""SELECT uname FROM user WHERE uname = 'test 1' """).fetchall())
     self.assertEqual(name,"[('test 1',)]")