import gmhttp
import unittest
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
import sys
sys.path.append(BASE_DIR)
from common.get_config import g





import os,sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
func = os.path.basename(__file__).split('_test.py')[0]
from common.gmpackage import *
@ddt
class Wechat_Small_Phone_Login(unittest.TestCase):
    '''
    
    '''

    @classmethod
    def setUpClass(cls):
        cls.host = g.host
        cls.api_name = g.api_name(func)
        cls.url = cls.host + cls.api_name
        print('获取环境信息和接口信息')
        self.host = g.host
        self.api_name = g.api_name(os.path.basename(__file__).split('_test.py')[0])
        self.android_params = g.android_params
    @data(*(get_values(func, "test_wechat_small_phone_login")))
    def test_wechat_small_phone_login(self,value):
        self._testMethodDoc = "--"
        '''
        
        '''
        url = self.host + self.api_name + "?" + self.android_params
        data = {
            'phone': g.get_info('user_info', 'code_login_tle'),
            'code': g.get_info('user_info', 'ms_code')
        }
        r = gmhttp.post(url, verify=False, data=data)
        self.assertEqual(r.status_code, 200, '返回码不为200！')
        r = r.json()
        print(r)
        self.assertEqual(r.get("error"),0)
        print('用例执行完毕!')


    def tearDown(self):
        pass


if __name__ == "__main__":
    Wechat_Small_Phone_Login.run()