import requests
import unittest

from param import params
from login import case_login
from case import getMethod


class Case(unittest.TestCase):
    # 全局变量
    s = requests.session()
    uri = params.uri
    test_uri = "http://earth.gmapp.env"
    master_uri = "http://earth.iyanzhi.com"

    #类内变量
    detail = params.detail
    detail_search = params.detail_search
    detail_index = params.detail_index
    @classmethod
    def setUpClass(cls):
        # 调用登陆类 传入会话保持，进行赋值
        cls.login = case_login.login(cls.s)
        # 带有会话保持的类调用期方法。传入uri  相当于已经赋予了值
        cls.login.LoginMethod(cls.uri)

    # 通用接口
    def test_01(self):
        '标签信息接口'
        p = "标签信息接口"
        url = self.uri + self.detail
        result = self.s.get(url=url)
        getMethod.getmethod(p,result)

    #创建标签接口 暂时不写
    #def test_02(self):
    #    '创建标签'
    #    p = "创建标签"

    def test_03(self):
        '标签搜索接口'
        p = "标签搜索接口"
        url = self.uri + self.detail_search
        result = self.s.get(url=url)
        getMethod.getmethod(p,result)

    def test_04(self):
        '标签选择页面数据接口'
        p = "标签选择页面数据接口"
        url = self.uri + self.detail_index
        result = self.s.get(url=url)
        getMethod.getmethod(p,result)

    def test_05(self):
        '标签选择页面数据'
        p = "标签选择页面数据"
        url = self.uri + self.detail_index
        result = self.s.get(url=url)
        getMethod.getmethod(p,result)

    
