예제 #1
0
 def setUp(self):
     _info = common_log.Common_Log()
     _info.set_result_true()   # set result is True
     _info.log("======== Start Test ========")
     # _info.log(__file__)
     print("Start Test")
     pass
예제 #2
0
 def __init__(self, index_name, index_type, ip='127.0.0.1'):
     self._info = common_log.Common_Log()
     '''
     :param index_name: 索引名称
     :param index_type: 索引类型
     '''
     self.index_name = index_name
     self.index_type = index_type
     # 无用户名密码状态
     self.es = Elasticsearch([ip])
예제 #3
0
 def tearDown(self):
     _info = common_log.Common_Log()
     if _info.get_result()[0] == "True":
         _info.log("-------- Pass Test --------")
         _info.log()
         print("Pass Test")
         pass
     else:
         _info.log("******** Fail Test ********")
         _info.log()
         print("Fail Test")
         assert False
예제 #4
0
instanttiate common_requests
:return:
'''
api_url = config.api_url
t = common_requests.Common_Requests(api_url)
get_data = set_post_data.set_data()
check_res = check_result.check_assert_result()
'''
instanttiate ElasticObj
:return:
'''
es_ip = config.es_ip
index_type = config.index_type
index_name = config.index_name
es = elastic_search.ElasticObj(index_name,index_type,es_ip)
_info = common_log.Common_Log()

#################################################################
# ---------------------------用例脚本-------------------------- #
#################################################################

class test_API_searchByTireSize(common_start.MyTest):

    def test_check_api_and_es_results(self):
        _info.log("test file name:" + os.path.basename(__file__))
        _info.log(self.__class__.__name__+"."+sys._getframe().f_code.co_name)
        data = get_data.get_tires_data()
        form_data = data.get("form_data")
        path = config.path['get_searchByTireSize']
        response = t.post(path, form_data)
        check_res.check_str(response.json().get('code'),100000)
예제 #5
0
 def __init__(self):
     self._info = common_log.Common_Log()
예제 #6
0
 def __init__(self, items=None, hits=None):
     self.items = items
     self.hits = hits
     self._info = common_log.Common_Log()
예제 #7
0
 def __init__(self, url, key):
     self.url = url
     self.key = key
     self._info = common_log.Common_Log()
예제 #8
0
 def __init__(self, file_path):
     self._info = common_log.Common_Log()
     self.file_path = file_path