# -*- coding: utf-8 -*-
# @Time    : 2021/4/20 14:37
# @Author  : wangyinghao
# @FileName: api_test_task.py
# @Software: PyCharm
# from django.db import models
# from automated_main.models.api_automation.api_project import APIProject
# from automated_main.models.api_automation.api_environment import APIEnvironment
# from automated_main.models.api_automation.api_database import APIDatabase

"""
8.19 弃用
"""
# class APITestTask(models.Model):
#     """
#     API任务表
#     """
#     api_test_task_name = models.CharField("API测试任务名称", max_length=100, blank=False, default="")
#     describe = models.TextField("描述", default="", null=True)
#     status = models.IntegerField("状态：", default=0)  # 未执行、执行中、执行完成、排队中
#     cases = models.TextField("关联API用例", default="")
#     api_send_email = models.CharField("API邮件发送", max_length=9999, blank=True, default="", null=True)
#     api_send_enterprise_wechat = models.IntegerField("API企业微信发送消息", blank=True, default="0")
#     api_environment = models.ForeignKey(APIEnvironment, on_delete=models.CASCADE)
#     timing_task_status = models.CharField("定时任务是否开启", max_length=50, blank=True, default="", null=True)
#     starting_time = models.CharField("起始时间", max_length=50, blank=True, default="", null=True)
#     end_time = models.CharField("截至时间", max_length=50, blank=True, default="", null=True)
#     time_interval_day = models.IntegerField("间隔时间-天", blank=True, default=0, null=True)
#     time_interval_minutes = models.IntegerField("间隔时间-分钟", blank=True, default=0, null=True)
#     time_interval_hours = models.IntegerField("间隔时间-小时", blank=True, default=0, null=True)
#     time_interval_seconds = models.IntegerField("间隔时间-秒", blank=True, default=0, null=True)
#     database = models.ForeignKey(APIDatabase, on_delete=models.CASCADE)
#     api_project = models.ForeignKey(APIProject, on_delete=models.CASCADE)
#     update_time = models.DateTimeField(auto_now_add=True)
#     create_time = models.DateTimeField("创建时间", auto_now_add=True)
#
#     def __str__(self):
#         return self.api_test_task_name
#
#
# class APITestResult(models.Model):
#     """
#     API测试结果表
#     """
#     api_test_result_name = models.CharField("api测试报告名称", max_length=200, blank=False, default="")
#     api_task = models.ForeignKey(APITestTask, on_delete=models.CASCADE)
#     api_error_total_number = models.CharField("失败总数", max_length=100, null=True, blank=True)
#     api_successful_total_number = models.CharField("成功总数", max_length=100, null=True, blank=True)
#     api_total_number = models.CharField("API总数", max_length=100, null=True, blank=True)
#     api_environment_id = models.CharField("API环境", max_length=100, null=True, blank=True)
#     update_time = models.DateTimeField(auto_now_add=True)
#     create_time = models.DateTimeField("创建时间", auto_now_add=True)
#
#     def __str__(self):
#         return self.api_test_result_name
#
#
# class APITestResultAssociated(models.Model):
#     """
#     API测试结果关联表
#     """
#     api_test_case_name = models.CharField("api测试用例名称", max_length=100, blank=False, default="")
#     api_task = models.ForeignKey(APITestTask, on_delete=models.CASCADE)
#     api_result = models.ForeignKey(APITestResult, on_delete=models.CASCADE)
#     api_error = models.CharField("失败", max_length=100, null=True, blank=True)
#     api_successful = models.CharField("成功", max_length=100, null=True, blank=True)
#     abnormal = models.TextField("异常", max_length=5000, null=True, blank=True)
#     json_extract_variable_conversion = models.TextField("json提取变量转换",
#                                                         max_length=5000, null=True, blank=True)
#     api_assertion_results = models.TextField("断言结果", max_length=5000, null=True, blank=True)
#     api_variable_results = models.TextField("参数提取", max_length=5000, null=True, blank=True)
#     api_request_results = models.JSONField("API请求结果", null=True, default=None)
#     api_business_test_name = models.TextField("API业务测试名称", max_length=5000, null=True, blank=True)
#     api_header = models.TextField("header", max_length=5000, null=True, blank=True)
#     api_url = models.TextField("请求地址", max_length=5000, null=True, blank=True)
#     api_body = models.TextField("body", max_length=5000, null=True, blank=True)
#     update_time = models.DateTimeField(auto_now_add=True)
#     create_time = models.DateTimeField("创建时间", auto_now_add=True)
#
#     def __str__(self):
#         return self.api_test_case_name
