forked from meolu/walle-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_04_api_passport.py
44 lines (36 loc) · 1.09 KB
/
test_04_api_passport.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
"""Test Apis."""
from flask import json
import types
import urllib
import pytest
from .utils import *
from .test_03_api_user import user_data
from .test_00_base import user_data_login
from copy import deepcopy
@pytest.mark.usefixtures('db')
class TestApiPassport:
"""api role testing"""
uri_prefix = '/api/passport'
user_id = {}
user_data = user_data
user_data_login = deepcopy(user_data_login)
user_name = u'[email protected]'
def test_login(self, user, testapp, client, db):
"""create successful."""
# 1.create another role
query = {
'page': 1,
'size': 1,
'kw': self.user_name
}
response = {
'count': 1,
}
resp = client.get('/api/user/?%s' % (urlencode(query)))
response_success(resp)
compare_req_resp(response, resp)
resp = client.post('%s/login' % (self.uri_prefix), data=self.user_data_login)
response_success(resp)
del self.user_data_login['password']
compare_req_resp(self.user_data_login, resp)