Exemple #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)
Exemple #2
0
    def __init__(self, email='*****@*****.**', password='******'):
        app.debug = True
        self.app = app.test_client()

        self.user = None
        self.email = email
        self.password = password
Exemple #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, '状态码返回错误')
Exemple #4
0
    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>')
Exemple #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, '状态码返回错误')
Exemple #6
0
 def setUp(self):
     self.app = app.test_client()
     self.app.testing = True
     db.drop_all()
     db.create_all()
def call_client(request):
    client = app.test_client()
    return client
 def setUp(self):
     self.app = app.test_client()
     self.app.testing = True
Exemple #9
0
 def setUp(self):
     app.testing = True
     self.client = app.test_client()