예제 #1
0
 def setUp(self):
     with app.test_request_context():
         self.url = urljoin(app.config['HOST_URL'],
                            url_for('main.quarterly'))
         client = app.test_client()
         self.response = client.get(self.url)
         self.data = self.response.get_data(as_text=True)
예제 #2
0
파일: tests.py 프로젝트: fri-iv/fambook
    def __init__(self, email='*****@*****.**', password='******'):
        app.debug = True
        self.app = app.test_client()

        self.user = None
        self.email = email
        self.password = password
예제 #3
0
 def test_login(self):
     """测试用户名和密码错误的情况[当登录名和密码错误的时候,返回 errcode = -1]"""
     response = app.test_client().post('/login', data={})
     json_data = response.data
     json_dict = json.loads(json_data)
     self.assertIn('errcode', json_dict, '数据格式返回错误')
     self.assertEqual(json_dict['errcode'], -1, '状态码返回错误')
예제 #4
0
파일: __init__.py 프로젝트: timechild/arke
    def setUp(self):
        self.app = self.create_app()
        self.app = app.test_client()
        self.db = db
        self.db.create_all()

        Video.add_video(self=Video,
                        title='CNN Title Video',
                        description='Video-test description',
                        url='cnn.com',
                        source='CNN',
                        iframe='<iframe>cnn.com/video</iframe>')
예제 #5
0
    def test_register(self):
        """测试用户名与密码为空的情况[当参数不全的话,返回errcode=-2]"""
        response = app.test_client().post('/register',
                                          data={
                                              "username": "******",
                                              "password": "******",
                                              "phone_number": "18600766147",
                                              "role_type": "1"
                                          })
        json_data = response.data
        json_dict = json.loads(json_data)

        self.assertIn('errcode', json_dict, '数据格式返回错误')
        self.assertEqual(json_dict['errcode'], -2, '状态码返回错误')
예제 #6
0
 def setUp(self):
     self.app = app.test_client()
     self.app.testing = True
     db.drop_all()
     db.create_all()
예제 #7
0
def call_client(request):
    client = app.test_client()
    return client
 def setUp(self):
     self.app = app.test_client()
     self.app.testing = True
예제 #9
0
 def setUp(self):
     app.testing = True
     self.client = app.test_client()