TestCaseDomain.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class TestCaseDomain(object):
  6. def __init__(self):
  7. self._action = None
  8. self._case_id = None
  9. self._collection_id = None
  10. self._desc = None
  11. self._ext_infos = None
  12. self._priority = None
  13. @property
  14. def action(self):
  15. return self._action
  16. @action.setter
  17. def action(self, value):
  18. self._action = value
  19. @property
  20. def case_id(self):
  21. return self._case_id
  22. @case_id.setter
  23. def case_id(self, value):
  24. self._case_id = value
  25. @property
  26. def collection_id(self):
  27. return self._collection_id
  28. @collection_id.setter
  29. def collection_id(self, value):
  30. self._collection_id = value
  31. @property
  32. def desc(self):
  33. return self._desc
  34. @desc.setter
  35. def desc(self, value):
  36. self._desc = value
  37. @property
  38. def ext_infos(self):
  39. return self._ext_infos
  40. @ext_infos.setter
  41. def ext_infos(self, value):
  42. self._ext_infos = value
  43. @property
  44. def priority(self):
  45. return self._priority
  46. @priority.setter
  47. def priority(self, value):
  48. self._priority = value
  49. def to_alipay_dict(self):
  50. params = dict()
  51. if self.action:
  52. if hasattr(self.action, 'to_alipay_dict'):
  53. params['action'] = self.action.to_alipay_dict()
  54. else:
  55. params['action'] = self.action
  56. if self.case_id:
  57. if hasattr(self.case_id, 'to_alipay_dict'):
  58. params['case_id'] = self.case_id.to_alipay_dict()
  59. else:
  60. params['case_id'] = self.case_id
  61. if self.collection_id:
  62. if hasattr(self.collection_id, 'to_alipay_dict'):
  63. params['collection_id'] = self.collection_id.to_alipay_dict()
  64. else:
  65. params['collection_id'] = self.collection_id
  66. if self.desc:
  67. if hasattr(self.desc, 'to_alipay_dict'):
  68. params['desc'] = self.desc.to_alipay_dict()
  69. else:
  70. params['desc'] = self.desc
  71. if self.ext_infos:
  72. if hasattr(self.ext_infos, 'to_alipay_dict'):
  73. params['ext_infos'] = self.ext_infos.to_alipay_dict()
  74. else:
  75. params['ext_infos'] = self.ext_infos
  76. if self.priority:
  77. if hasattr(self.priority, 'to_alipay_dict'):
  78. params['priority'] = self.priority.to_alipay_dict()
  79. else:
  80. params['priority'] = self.priority
  81. return params
  82. @staticmethod
  83. def from_alipay_dict(d):
  84. if not d:
  85. return None
  86. o = TestCaseDomain()
  87. if 'action' in d:
  88. o.action = d['action']
  89. if 'case_id' in d:
  90. o.case_id = d['case_id']
  91. if 'collection_id' in d:
  92. o.collection_id = d['collection_id']
  93. if 'desc' in d:
  94. o.desc = d['desc']
  95. if 'ext_infos' in d:
  96. o.ext_infos = d['ext_infos']
  97. if 'priority' in d:
  98. o.priority = d['priority']
  99. return o